Who it is forA platform team that needs a document parsing service for long PDFs.
The problemServing OCR for hundred-page documents runs out of memory or context with standard settings.
The outcomeAn SGLang server for Unlimited-OCR-2 with page-window scheduling for very long documents.
What you need first
- An NVIDIA GPU (tested on an A800 80GB) with CUDA
- Python 3.10 with torch 2.13.0 and transformers 4.52.1, or uv for the SGLang setup
- PyMuPDF to convert PDFs to page images
Steps
- Run
uv venv --python 3.10andsource .venv/bin/activate - Install the customized SGLang wheel from the repo, then
uv pip install pymupdf==1.27.2.2anduv pip install fastokens==0.3.2 - Set the page-window variables, for example SGLANG_UOCR_EANABLE_DOC_LIMIT=1 and SGLANG_UOCR_DOC_GUNDAM_PAGE_WINDOW=10
- Start it with
python -m sglang.launch_serverand--model-path baidu/Unlimited-OCR-2plus the README flags - Send PDFs converted with PyMuPDF and check memory on the first long document
Prompt for your agent
Set up baidu/Unlimited-OCR's SGLang server following the README exactly, with page windows of 10, then parse <long.pdf> through it and tell me peak GPU memory and time per page.
Caveat.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for baidu/Unlimited-OCR and "Serve Unlimited OCR 2 with SGLang for hundred-page PDFs"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer