导语:百度开源了一款仅 3B 参数的轻量级 OCR 模型,支持一次性解析整本 100 页 PDF,而非传统工具那样逐页切割丢失上下文。模型已斩获 93% 标准解析基准分,40 页以后错误率低于 0.11,完全本地运行、永久免费。
工具背景
Unlimited-OCR 由百度研究团队开发,于 2026 年 6 月正式开源。项目的核心目标是推动长文档解析进入”一次搞定”(One-shot Long-horizon Parsing)时代——让 AI 一次性理解整份文档的完整上下文,而不是把文档拆成碎片逐页处理。
传统云端 OCR(AWS Textract、Google Vision、Azure Doc Intelligence)每 1000 页收费 1.5~15 美元。Unlimited-OCR 跑在你的本地机器上,省钱、隐私、永久免费。
GitHub 上线一个月即获 190 万次下载,TinyBERT 身材(3B 参数),却能完成GPT-4V 级别的文档理解。
核心能力
截图展示

系统要求
| 项目 | 最低要求 | |——|———-| | 显存 | ≥ 16GB(bf16);INT4 量化 ≥ 8GB | | 显卡 | NVIDIA GPU(CUDA 12.x) | | Python | 3.12+ | | 依赖库 | torch 2.10 / transformers 4.57 / PyMuPDF 等 |
快速安装(Transformers)
pip install torch torchvision transformers Pillow einops pymupdf
python -c "
import os, torch
from transformers import AutoModel, AutoTokenizer
model = AutoModel.from_pretrained(
'baidu/Unlimited-OCR',
trust_remote_code=True,
torch_dtype=torch.bfloat16,
)
model = model.eval().cuda()
tokenizer = AutoTokenizer.from_pretrained('baidu/Unlimited-OCR', trust_remote_code=True)
单图 OCR
model.infer(tokenizer,
prompt='document parsing.',
image_file='your_image.jpg',
output_path='./outputs',
base_size=1024, image_size=640, crop_mode=True,
max_length=32768,
no_repeat_ngram_size=35, ngram_window=128,
save_results=True)
PDF 多页 OCR
model.infer_multi(tokenizer,
prompt='Multi page parsing.',
image_files=['page1.png', 'page2.png'], # 预先用 PyMuPDF 转成图片
output_path='./outputs',
image_size=1024, max_length=32768,
no_repeat_ngram_size=35, ngram_window=1024,
save_results=True)
"
Docker 一键部署(vLLM)
docker run --rm --gpus all --network host --ipc host
vllm/vllm-openai:unlimited-ocr
baidu/Unlimited-OCR
--trust-remote-code
--logits_processors vllm.model_executor.models.unlimited_ocr:NGramPerReqLogitProcessor
--no-enable-prefix-caching
--mm-processor-cache-gb 0
部署后通过 OpenAI 兼容接口调用:
POST http://127.0.0.1:8000/v1/chat/completions
相关资源
| 资源 | 链接 | |——|——| | GitHub | https://github.com/baidu/Unlimited-OCR | | Hugging Face | https://huggingface.co/baidu/Unlimited-OCR | | 论文 (arXiv) | https://arxiv.org/abs/2606.23050 | | vLLM Recipe | https://recipes.vllm.ai/baidu/Unlimited-OCR | | 在线 Demo | https://huggingface.co/spaces/baidu/Unlimited-OCR |







