baidu /
Unlimited-OCR
Open OCR model that turns images and multi-page PDFs into structured text in one pass
- 28.2k stars
- 1.6k stars since 3 Oct
- Python
- Updated 10 days ago
- Some experience
- Models & local AI
Classic OCR tools read one page at a time and often lose layout, tables and reading order. Unlimited-OCR is a model that looks at page images and writes out the parsed document, and it is built to handle long inputs such as many pages in a single request.
You give it an image or a list of page images with a short prompt like 'document parsing.' or 'Multi page parsing.' For a single image there are two modes, 'gundam' (cropped, 640 px) and 'base' (1024 px). Multi-page and PDF input uses base mode only. A PDF is first turned into page images with PyMuPDF, then parsed together.
The README says it aims to push DeepSeek-OCR one step further and credits DeepSeek-OCR, DeepSeek-OCR-2 and PaddleOCR. It ships with a no-repeat n-gram setting to stop the model looping on long outputs. The code is MIT licensed and the weights are on Hugging Face and ModelScope.
What it does
Multi-page and PDF parsing
Pass several page images, or a PDF converted to images, and get one parsed result for the whole document.
Two single-image modes
Choose 'gundam' (cropped, image size 640) or 'base' (image size 1024) for a single image.
Three ways to run it
Use Hugging Face transformers on an NVIDIA GPU, a vLLM Docker image, or an SGLang server with an OpenAI-compatible API.
Batch script
infer.py starts an SGLang server and sends concurrent requests for a folder of images or a PDF.
Training and hosting options
The release notes say it supports training with ms-swift and is available on Baidu Cloud, ModelScope and a Hugging Face demo.
What you could build
- Convert a scanned PDF report into parsed text in a single multi-page run.
- Batch-process a folder of document images with infer.py and a few concurrent requests.
- Serve an OCR endpoint with vLLM or SGLang and call it from your own app.
- Compare its output against DeepSeek-OCR on your own documents.
- Fine-tune the model on your own document types with ms-swift.
Get started
Set up Python 3.12 with CUDA and the pinned packages listed in the README (torch, transformers, PyMuPDF and others). Then load baidu/Unlimited-OCR with transformers and call model.infer on an image or model.infer_multi on page images. For serving, follow the vLLM recipe or the SGLang steps.
docker pull vllm/vllm-openai:unlimited-ocrdocker pull vllm/vllm-openai:unlimited-ocr-cu129Commands are copied from the project's README. Read it on GitHub for the full setup.
More in Models & local AI
transformers
Shared model definitions for text, vision, audio and multimodal AI models