selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

baidu logo

Unlimited-OCR-2

baidu·Instruct·released 26 Oct 2026

MIT3.3BA1.1BMoE128K ctx ≈4.5 GB
Your GPU
llama-server -hf RX5950XT/Unlimited-OCR-2-GGUF:Q4_K_M
All 4 runners ↓

Unlimited-OCR-2 is an instruct-tuned OCR and document AI model from Baidu. It has 3.3B total parameters, of which 1.1B are active, using a mixture-of-experts design. It accepts image and text inputs, returns text, supports multilingual content and has a 131,072-token context window. The model is released under the MIT licence, which permits commercial use, and it has no family members listed in this directory.

How much VRAM does Unlimited-OCR-2 need?

At Q8_0 Unlimited-OCR-2 needs about 4.5 GB of GPU memory.

--vram
any
--gpus
--quant
QuantisationWeightsTotal
4-bitRecommended default for local use1.9 GB est.≈2.8 GB
8-bitrecommendedLossless in practice, twice the size of Q42.9 GB file≈4.0 GB
FP16 / BF16Full precision, as released5.5 GB file≈7.1 GB

Estimates for the weights plus runtime overhead; activations vary with resolution and batch size. Pick a GPU above and the fit column checks every row against it. Weights marked “file” use the real GGUF download size; “est.” rows are computed from the parameter count.

Can the RTX 4060 run Unlimited-OCR-2? →

Run Unlimited-OCR-2 locally

--quantQ4_K_Mdefault; pick your GPU to tailor itRX5950XT/Unlimited-OCR-2-GGUF

OpenAI-compatible server with a web UIdocs
llama-server -hf RX5950XT/Unlimited-OCR-2-GGUF:Q4_K_M

Downloads the GGUF on first run. Installed through llama.app? The same flags work with `llama serve`.

Install llama.cpp

Serve an OpenAI-compatible APIdocs
vllm serve baidu/Unlimited-OCR-2
Smaller FP8 builddocs
vllm serve AutomatosX/AX-Unlimited-OCR-2-AXQ-MXFP8
Docker Compose (NVIDIA)docs
yaml
services:
  vllm:
    image: vllm/vllm-openai:latest
    command: baidu/Unlimited-OCR-2
    ports:
      - "8000:8000"
    ipc: host
    volumes:
      - ~/.cache/huggingface:/root/.cache/huggingface
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]

API on port 8000.

Install vLLM

Serve an OpenAI-compatible APIdocs
sglang serve baidu/Unlimited-OCR-2 --host 0.0.0.0 --port 30000
Docker Compose (NVIDIA)docs
yaml
services:
  sglang:
    image: lmsysorg/sglang:latest
    command: sglang serve baidu/Unlimited-OCR-2 --host 0.0.0.0 --port 30000
    ports:
      - "30000:30000"
    ipc: host
    volumes:
      - ~/.cache/huggingface:/root/.cache/huggingface
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]

API on port 30000.

Install SGLang

Ask about an imagedocs
python
from transformers import pipeline

pipe = pipeline("image-text-to-text", model="baidu/Unlimited-OCR-2", dtype="auto", device_map="auto")
messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg"},
            {"type": "text", "text": "Describe this image."},
        ],
    }
]
out = pipe(text=messages, max_new_tokens=256)
print(out[0]["generated_text"][-1]["content"])

Install Transformers

Quantised versions and downloads

About Unlimited-OCR-2

Sparse Reference Sliding Window Attention (SR-SWA): Compresses text-visual attention interactions from ultra-long sequences down to a fixed-size set of working references (e.g., 512 tokens). This bounds computational complexity, keeping per-step decoding latency and memory footprint nearly constant regardless of document length. From Long- to Unlimited-Horizon Parsing: Powered by SR-SWA, Unlimited-OCR 2 achieves true, unbounded document parsing within a finite context window—effectively eliminating quadratic attention scaling and memory bottlenecks as documents grow. * Ultra-Long Document Parsing SOTA: Achieves state-of-the-art performance across both dozens-of-pages benchmarks (e.g., MPDocBench) and extreme hundred-page benchmarks (e.g., MarathonDocBench). Unlimited OCR 2 supports Transformers (native, for quick tests) and SGLang (recommended for serving). Tested with Python 3.10, torch==2.13.0, transformers==4.52.1, huggingface-hub==0.36.0, tokenizers==0.21.4, on an NVIDIA A800-80GB: Load the model once: Multi-page inference (infer_multi). All pages of a document are parsed in one request, so the model can use cross-page context. Pass the page images in page order: The prompt is built automatically as " " * num_pages + "Multi page parsing.", and each page is encoded as one global view (base mode). The output contains one per input page, in the same order as image_files.

Full model card on Hugging Face →

Alternatives to Unlimited-OCR-2

All alternatives →
baidu logo

Unlimited-OCR

baidu·OCR

≈4.5 GB

Please refer to the official vLLM recipe for deployment details:

3.3BA1.1B32K ctx MIT
5.6MJun 2026gguf
deepseek-ai logo

DeepSeek-OCR

deepseek-ai·OCR

≈4.5 GB

Refer to 🌟GitHub for guidance on model inference acceleration and PDF processing, etc.

3.3BA1.1B8K ctx MIT
1.8MOct 2025ollama
deepseek-ai logo

DeepSeek-OCR-2

deepseek-ai·OCR

≈4.5 GB

Refer to 🌟GitHub for guidance on model inference acceleration and PDF processing, etc.

3.4BA1.2B8K ctx Apache 2.0
216.2KJan 2026gguf
nanonets logo

Nanonets-OCR2-3B

nanonets·OCR

≈5.0 GB

Nanonets-OCR2 by Nanonets is a family of powerful, state-of-the-art image-to-markdown OCR models that go far beyond traditional text extraction.

3.8B125K ctx Unknown licence
895.5KOct 2025gguf
dots-studio logo

dots.mocr

dots-studio·OCR

≈4.1 GB

We present dots.mocr. Beyond achieving state-of-the-art (SOTA) performance in standard multilingual document parsing among models of comparable size, dots.mocr excels at converting structured graphics (e.g., charts, UI layouts, scientific figures and etc.) directly into SVG code.

3B128K ctx MIT
58.8KMar 2026gguf
dots-studio logo

dots.ocr

dots-studio·OCR

≈4.1 GB

dots.ocr is a powerful, multilingual document parser that unifies layout detection and content recognition within a single vision-language model while maintaining good reading order. Despite its compact 1.7B-parameter LLM foundation, it achieves state-of-the-art(SOTA) performance.

3B128K ctx MIT
355.1KJul 2025gguf

Unlimited-OCR-2 FAQ

How much VRAM does Unlimited-OCR-2 need?
About 4.5 GB at Q8_0. Full precision needs about 8.0 GB.
Can Unlimited-OCR-2 run on the RTX 4060?
Yes. It fits at FP16 / BF16 (about 7.1 GB). It fits comfortably on the Apple M4 (16 GB), Radeon RX 6700 XT, RTX 3060 12GB.
Can I use Unlimited-OCR-2 commercially?
Yes. It is released under MIT. Permissive: do almost anything as long as you keep the copyright notice.
How do I run Unlimited-OCR-2 with llama.cpp?
Run llama-server -hf RX5950XT/Unlimited-OCR-2-GGUF:Q4_K_M. It downloads the GGUF and starts an OpenAI-compatible server.

Data from Hugging Face, the model card and public leaderboards. Memory and speed figures are estimates; real numbers depend on the runtime, context length and drivers. Always check the licence yourself before commercial use.