More on the topic...
Generating detailed summary...
Failed to generate summary. Please try again.
Unlimited-OCR builds on Deepseek-OCR to handle both single images and multi-page documents with a context window up to 32,768 tokens. The repo ships with a Hugging Face demo, an arXiv paper (2606.23050), and a ModelScope release. Out of the box it supports two image configs: “gundam” (base_size=1024, image_size=640, crop_mode=True) and “base” (1024×1024, no crop). You grab the model via transformers (torch==2.10.0, torchvision==0.25.0, transformers==4.57.1, Pillow, matplotlib, einops, addict, easydict, pymupdf, psutil) and run model.infer or model.infer_multi for images or PDF-converted pages.
For PDF conversion, they use PyMuPDF to render pages at 300 DPI into PNGs, then feed those into model.infer_multi with image_size=1024 and a no_repeat_ngram constraint (35 ngrams, window up to 1,024). They also provide an SGLang-based server that wraps the model behind an OpenAI-style streaming chat API. After installing a local SGLang wheel, kernels==0.11.7, pymupdf, you launch with python -m sglang.launch_server specifying model name Unlimited-OCR, attention-backend fa3, page-size 1, static memory fraction 0.8, context-length 32768, custom logit processor enabled, and host/port.
The client code builds requests by base64-encoding images and sending them alongside text prompts like “<image>document parsing.” You can specify image_mode (“gundam” or “base”) and ngram_window. The server streams token deltas until “[DONE]”. For batch jobs there’s infer.py: point it at an image directory or a PDF, set concurrency (e.g. 8), choose image_mode, and it spins up the SGLang server automatically, processes pages concurrently, and writes results to your output folder. They credit Deepseek-OCR, Deepseek-OCR-2, and PaddleOCR for inspiration and models.
Questions about this article
No questions yet.