{
 "schema_version": 1,
 "generated": "2026-10-30",
 "id": "baidu-unlimited-ocr--serve-unlimited-ocr-2-with-sglang-for-batch-pdf-parsing",
 "repo": "baidu/Unlimited-OCR",
 "repo_url": "https://github.com/baidu/Unlimited-OCR",
 "repo_slug": "baidu-unlimited-ocr",
 "title": "Serve Unlimited OCR 2 with SGLang for hundred-page PDFs",
 "page_title": "How to serve Unlimited OCR 2 with SGLang for hundred-page PDFs with Unlimited OCR",
 "summary": "Set up the customized SGLang build and run a server tuned for very long documents.",
 "who": "A platform team that needs a document parsing service for long PDFs.",
 "problem": "Serving OCR for hundred-page documents runs out of memory or context with standard settings.",
 "outcome": "An SGLang server for Unlimited-OCR-2 with page-window scheduling for very long documents.",
 "steps": [
  "Run `uv venv --python 3.10` and `source .venv/bin/activate`",
  "Install the customized SGLang wheel from the repo, then `uv pip install pymupdf==1.27.2.2` and `uv 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_server` and `--model-path baidu/Unlimited-OCR-2` plus the README flags",
  "Send PDFs converted with PyMuPDF and check memory on the first long document"
 ],
 "agent_prompt": "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.",
 "agents": [
  "claude-code",
  "codex"
 ],
 "difficulty": "Advanced",
 "time": "2 hours",
 "basis": "readme",
 "caveat": "",
 "category": "Data and analytics",
 "tags": [
  "Data and analytics"
 ],
 "lang": "python",
 "requirements": [
  "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"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/baidu-unlimited-ocr/serve-unlimited-ocr-2-with-sglang-for-batch-pdf-parsing/",
 "md": "https://dedupedai.com/use-cases/baidu-unlimited-ocr/serve-unlimited-ocr-2-with-sglang-for-batch-pdf-parsing/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/baidu-unlimited-ocr--serve-unlimited-ocr-2-with-sglang-for-batch-pdf-parsing.json",
 "api_version": "v1"
}
