SAVRN
Search Contact SAVRN

Open-weight model · Image and text to text

Unlimited-OCR-AWQ

by Sahil Chachra sahilchachra/Unlimited-OCR-AWQ

AWQ 4-bit (W4A16) quantization of baidu/Unlimited-OCR, a 3B vision-language OCR model that pushes DeepSeek-OCR one step further (one-shot, long-horizon document parsing).

Parameters3.4B
Context32,768
Weights2.8 GB
Licensemit
AccessOpen weights
Monthly Downloads1.3M

Runs On

What it takes to serve Unlimited-OCR-AWQ (3.4B parameters): the memory its weights need at each precision, and the cheapest way to rent enough data-center GPUs to hold them.

PrecisionWeightsMemory neededCheapest setupPer hourAlso fits
16-bit 6.7 GB 8.1 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
8-bit 3.4 GB 4.0 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
4-bit 1.7 GB 2.0 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00

Memory is the weights at that precision plus 20% for the runtime and a short context; a long context needs more. Prices are the lowest on-demand hourly rates in the SAVRN Index, read Sep 18, 2026.

Model Card

By Sahil Chachra, published under mit, revision 0ad8e3cfd1fa.

AWQ 4-bit (W4A16) quantization of baidu/Unlimited-OCR, a 3B vision-language OCR model that pushes DeepSeek-OCR one step further (one-shot, long-horizon document parsing). This repo quantizes the DeepSeek-V2 MoE text decoder with activation-aware scaling (AWQ) while keeping the vision tower in BF16, so it stays a drop-in transformers model. Unlimited-OCR uses the DeepSeek-OCR prompt vocabulary. The prompt must contain; prefix it with whenever you also want bounding boxes for what was read. - base — basesize=1024, imagesize=1024, cropmode=False. Good default for normal pages. - gundam — basesize=1024, imagesize=640, cropmode=True. Tiles the page; use for dense or large/high-resolution…

Read Sahil Chachra's full model card

Unlimited-OCR — AWQ (W4A16)

AWQ 4-bit (W4A16) quantization of baidu/Unlimited-OCR, a 3B vision-language OCR model that pushes DeepSeek-OCR one step further (one-shot, long-horizon document parsing). This repo quantizes the DeepSeek-V2 MoE text decoder with activation-aware scaling (AWQ) while keeping the vision tower in BF16, so it stays a drop-in transformers model.

Runtime requirements. This is custom remote code, so load with trust_remote_code=True, transformers 4.57.x, and compressed-tensors installed. W4A16 (int4) runs on any CUDA GPU; compressed-tensors handles the 4-bit unpacking at load.

This quant

Scheme W4A16 · int4 symmetric · group 128 · pack-quantized
Method AWQ (llm-compressor) — activation-aware, text-calibrated
Calibration 64 × 512-token general-text sequences (text-only forward)
Quantized text-decoder Linears (attention q/k/v/o, all experts + shared gate/up/down, dense gate/up)
Kept in BF16 vision tower (sam_model, vision_model), projector, token embeddings, lm_head, the MoE router gate, all norms, and the single dense layer-0 down_proj (width 6848 not divisible by group 128)
Quantized by sahilchachra

Quick start

pip install "transformers==4.57.3" compressed-tensors accelerate torch torchvision \
            einops addict easydict matplotlib pillow
import torch
from transformers import AutoModel, AutoTokenizer

repo = "sahilchachra/Unlimited-OCR-AWQ"
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModel.from_pretrained(repo, trust_remote_code=True,
                                  dtype=torch.bfloat16, device_map="cuda").eval()

text = model.infer(
    tok,
    prompt="<image>\n<|grounding|>Convert the document to markdown.",
    image_file="document.png", output_path="./out",
    base_size=1024, image_size=1024, crop_mode=False,   # "base" mode
    save_results=True, eval_mode=True,
)
print(text)

Prompting guide

Unlimited-OCR uses the DeepSeek-OCR prompt vocabulary. The prompt must contain <image>; prefix it with <|grounding|> whenever you also want bounding boxes for what was read.

Task Prompt
Document → Markdown (layout-aware, with boxes) <image>\n<|grounding|>Convert the document to markdown.
Plain text OCR (just the text, no layout) <image>\nFree OCR.
OCR with bounding boxes <image>\n<|grounding|>OCR this image.
Native Unlimited-OCR parse <image>document parsing.
Parse a figure / chart / diagram <image>\nParse the figure.
Describe the image (general VQA) <image>\nDescribe this image in detail.
Find specific text (referring grounding) <image>\n<|grounding|>Locate <|ref|>Total Due<|/ref|> in the image.
Multi-page / PDF <image>Multi page parsing. via model.infer_multi(...)

Resolution modes

  • basebase_size=1024, image_size=1024, crop_mode=False. Good default for normal pages.
  • gundambase_size=1024, image_size=640, crop_mode=True. Tiles the page; use for dense or large/high-resolution documents.

Understanding the output (grounding tokens)

With <|grounding|>, the model interleaves the recognized text with detection boxes:

<|det|>title [37, 64, 464, 132]<|/det|>INVOICE #2026-0623
<|det|>text  [37, 194, 350, 247]<|/det|>Bill To: Sahil Chachra
<|det|>text  [37, 483, 329, 543]<|/det|>Total Due: $44.00

Each [x1, y1, x2, y2] is the bounding box (top-left → bottom-right) of that span, in the coordinate space of the model's input image. Drop the <|det|>...<|/det|> tags if you only want text, or parse them to overlay boxes / rebuild layout. Without <|grounding|> you get plain text (or Markdown) with no box tags.

Serving

The original model ships an SGLang wheel and a vLLM path (see the base model card). W4A16 / compressed-tensors weights load directly in runtimes with compressed-tensors support (e.g. vLLM); otherwise use the transformers snippet above.

About the model

  • Architecture: UnlimitedOCRForCausalLM (DeepSeek-OCR architecture) — a DeepEncoder vision tower (SAM-ViT-B + CLIP-L/14, 1024×1024 input, 16× downsample) → linear projector → DeepSeek-V2 MoE text decoder (12 layers, hidden 1280, 64 routed + 2 shared experts, 6 experts/token; layer 0 dense).
  • Task: multilingual OCR / document parsing — single image, multi-page, and PDF (one-shot long-horizon parsing).
  • License: MIT (inherited from the base model).

How this was made

Unlimited-OCR is custom remote code whose forward only runs the vision tower when images are passed, so AWQ calibration feeds text only (images=None), exercising the pure DeepSeek-V2 decoder. Per-layer AWQ mappings were built from the live module tree (attention input_layernorm→q,k,v and v→o; MoE post_attention_layernorm→ every expert + shared-expert gate/up, plus per-expert up→down). The fx-based "sequential" pipeline can't trace this custom model, so the basic pipeline (real end-to-end forward + activation hooks) was used.

Verified

Loaded in transformers and run on a test document — OCR output matches BF16, e.g.:

<|det|>title [37, 64, 464, 130]<|/det|>INVOICE #2026-0623
<|det|>text  [37, 480, 329, 540]<|/det|>Total Due: $44.00

Limitations

  • 4-bit weights trade a little accuracy for size; for the highest fidelity use the original BF16 model. For OCR, this AWQ build is effectively lossless on tested documents.
  • The vision encoder and MoE router stay BF16 (small, accuracy-sensitive).
  • English-/multilingual-text centric; verify critical fields on hard scans.

Other formats

Credits

Base model baidu/Unlimited-OCR (MIT), built on DeepSeek-OCR. Quantized with llm-compressor. License: MIT.

Configuration

Architecture
UnlimitedOCRForCausalLM
Context length (tokens)
32,768
Layers
12
Hidden size
1,280
Feed-forward size
6,848
Attention heads
10
Key/value heads
10
Vocabulary size
129,280
Routed experts
64
Experts active per token
6
Sliding window (tokens)
128
RoPE base
10000
Stored precision
bfloat16
Model type
unlimited-ocr
Quantization
compressed-tensors

Identity and Version

Repository
sahilchachra/Unlimited-OCR-AWQ
Publisher
Sahil Chachra
Task
Image and text to text
Modality
Image and text
Library
transformers
Parameters
3.4B parameters
Languages
awq, ocr, moe
Revision
0ad8e3cfd1fa10b87065309580f3ed9ea97777d9
First published
2026-06-23
Last updated
2026-06-23

Files and Weights

15 files, 2.8 GB in total. The weights are 1 file totalling 2.8 GB in safetensors.

Weights1 file · 2.8 GB
Configuration10 files · 440.1 KB
Tokenizer2 files · 10.1 MB
Documentation1 file · 7.0 KB
Repository1 file · 1.5 KB
Every file
FileTypeSizeSHA-256
model.safetensorsWeights2.8 GB 1a49afcb69c4
config.jsonConfiguration12.4 KB
configuration_deepseek_v2.pyConfiguration10.7 KB
conversation.pyConfiguration9.3 KB
deepencoder.pyConfiguration38.0 KB
generation_config.jsonConfiguration111 B
modeling_deepseekv2.pyConfiguration90.7 KB
modeling_unlimitedocr.pyConfiguration53.4 KB
processor_config.jsonConfiguration466 B
recipe.yamlConfiguration224.2 KB
special_tokens_map.jsonConfiguration801 B
README.mdDocumentation7.0 KB
.gitattributesRepository1.5 KB
tokenizer.jsonTokenizer10.0 MB
tokenizer_config.jsonTokenizer165.9 KB

License and Download

License
mit
Access
Open weights, no gate
Download size
2.8 GB
Download from Sahil Chachra

Released by Sahil Chachra through its official repository on Hugging Face. Read the license.

Built From

Memory Requirements

PrecisionWeights in memory
As published2.8 GB
16-bit6.7 GB
8-bit3.4 GB
4-bit1.7 GB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About Unlimited-OCR-AWQ

How much GPU memory does Unlimited-OCR-AWQ need?

About 8.1 GB at 16-bit and 2 GB at 4-bit: the weights (3.4B parameters) plus a working margin. A long context needs more.

What is the cheapest GPU to run Unlimited-OCR-AWQ on?

At 16-bit, 1x MI300X from $1.85 an hour; at 4-bit, 1x MI300X from $1.85 an hour, at the lowest on-demand prices the SAVRN Index lists.

Can I use Unlimited-OCR-AWQ commercially?

Yes. Unlimited-OCR-AWQ is released under MIT License. The MIT License is a short permissive license. It permits commercial use, modification and redistribution, provided the copyright notice and permission notice are included.

What is Unlimited-OCR-AWQ's context length?

32,768 tokens, from the maximum position embeddings in its published configuration.

Similar Models

Model · Image and text to text

DeepSeek-OCR

DeepSeek

Inference using Huggingface transformers on NVIDIA GPUs. Requirements tested on python 3.12.9 + CUDA11.8: Refer to GitHub for guidance on model inference acceleration and PDF processing, etc. [2025/10/23] DeepSeek-OCR is now officially supported in upstream vLLM. We would like to thank Vary, GOT-OCR2.0, MinerU, PaddleOCR, OneChart, Slow Perception for their valuable models and ideas. author={Wei, Haoran and Sun, Yaofeng and Li, Yukun}, year={2025}

Open weights mit 3.3B parameters 8,192 tokens transformers

Model · Image and text to text

Unlimited-OCR

BAIDU

[2026/07/21] Thanks to the ms-swift community for their support, our model now supports training with ms-swift. - [2026/07/03] Thanks to the Baidu Cloud team for their support. Our model is now available on Baidu Cloud. - [2026/06/28] Thanks to the vLLM community and Tianyu Guo for their support, our model now supports vLLM inference. - [2026/06/24] Thanks to AK for creating a demo for us. It is now available at Hugging Face Spaces. - [2026/06/23] Our paper is now available on arXiv. - [2026/06/23] Thanks to the ModelScope community for their support. Our model is now available at ModelScope. - [2026/06/22] We present Unlimited-OCR, aiming to push Deepseek-OCR one step further. Inference…

Open weights mit 3.3B parameters 32,768 tokens transformers

Model · Image and text to text

unlimited-ocr-max

Konstantin

baidu/Unlimited-OCR as one repository max serve opens directly on Apple Silicon: baidu's weights unchanged (model.safetensors, byte-identical to upstream at revision 07dea832e22aefee32ad281d4b80551282e1c168, sha256 2bc48a7a110061ea58fff65d3169367eebe3aee371ca6968dc2219c1b2855fc6), the tokenizer files as published, and the checkpoint's config.json with two keys removed (automap, modeltype) so MAX can load it without trustremotecode. The runtime is a MAX custom architecture with two Mojo custom ops, served from https://github.com/kthr/unlimited-ocr-max as an OpenAI-compatible endpoint on the Metal GPU or the CPU. The repository also carries model-int8.safetensors, this port's weight-only int8…

Open weights mit 3.3B parameters 32,768 tokens

Model · Image and text to text

DeepSeek-OCR-2

DeepSeek

Inference using Huggingface transformers on NVIDIA GPUs. Requirements tested on python 3.12.9 + CUDA11.8: Refer to GitHub for guidance on model inference acceleration and PDF processing, etc. We would like to thank DeepSeek-OCR, Vary, GOT-OCR2.0, MinerU, PaddleOCR for their valuable models and ideas. We also appreciate the benchmark OmniDocBench. author={Wei, Haoran and Sun, Yaofeng and Li, Yukun}, year={2025} title={DeepSeek-OCR 2: Visual Causal Flow}, author={Wei, Haoran and Sun, Yaofeng and Li, Yukun}, year={2026}

Open weights apache-2.0 3.4B parameters 8,192 tokens transformers

Model · Image and text to text

dots.ocr

Dots Studio

dots.ocr: Multilingual Document Layout Parsing in a Single Vision-Language Model 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. 1. Powerful Performance: dots.ocr achieves SOTA performance for text, tables, and reading order on OmniDocBench, while delivering formula recognition results comparable to much larger models like Doubao-1.5 and gemini2.5-pro. 2. Multilingual Support: dots.ocr demonstrates robust parsing capabilities for low-resource languages…

Open weights mit 3B parameters 131,072 tokens dots_ocr

Model · Image and text to text

dots.mocr

Dots Studio

dots.mocr 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. Its core capabilities encompass grounding, recognition, semantic understanding, and interactive dialogue. Simultaneously, we are releasing dots.mocr-svg, a variant specifically optimized for robust image-to-SVG parsing tasks. More information can be found in the paper. Visual languages (e.g., charts, graphics, chemical formulas, logos) encapsulate dense human knowledge. dots.mocr unifies the…

Open weights mit 3B parameters 131,072 tokens dots_mocr