Unlimited OCR AWQ

Providersahilchachra
Categoryocr
Licensemit
Downloads67
Stars0

Overview

Unlimited OCR AWQ is a specialized vision-language model optimized for high-accuracy optical character recognition and document parsing. By utilizing AWQ (Activation-aware Weight Quantization), the model significantly reduces VRAM overhead without sacrificing precision, making it ideal for deployment on consumer-grade GPUs or edge devices. Unlike general-purpose LLMs that may hallucinate text during extraction, this model is tuned for structural fidelity, making it highly effective for digitizing complex layouts, invoices, and handwritten notes. Developers can integrate it into automated data pipelines to convert unstructured imagery into machine-readable text with minimal latency and high throughput.

Highlights

  • AWQ quantization for efficient low-VRAM deployment
  • High-fidelity extraction of complex document layouts
  • Optimized for high-throughput OCR production pipelines
  • MIT licensed for flexible commercial integration

Usage

Install
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# Load model with transformers
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("sahilchachra/Unlimited-OCR-AWQ")
tokenizer = AutoTokenizer.from_pretrained("sahilchachra/Unlimited-OCR-AWQ")

Hugging Face Download

We recommend downloading the model via the Hugging Face CLI or Hub SDK.

Guidance:Before downloading, install huggingface_hub with:

Guidance
pip install -U huggingface_hub

CLI Download

Download the full repository

Download the full repository
huggingface-cli download sahilchachra/Unlimited-OCR-AWQ

Download a single file to a local folder (e.g. config.json into ./dir)

Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download sahilchachra/Unlimited-OCR-AWQ config.json --local-dir ./dir

See the official docs for more CLI options

SDK Download

SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('sahilchachra/Unlimited-OCR-AWQ')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://huggingface.co/sahilchachra/Unlimited-OCR-AWQ

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/sahilchachra/Unlimited-OCR-AWQ

Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.

PyTorch / Transformers Usage

Install Transformers

Install Transformers
pip install -U transformers torch

Load the model and run inference

Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('sahilchachra/Unlimited-OCR-AWQ')
tokenizer = AutoTokenizer.from_pretrained('sahilchachra/Unlimited-OCR-AWQ')

Model Download

We recommend downloading the model via the ModelScope CLI or SDK.

Guidance:Before downloading, install ModelScope with:

Guidance
pip install modelscope

CLI Download

Download the full repository

Download the full repository
modelscope download --model sahilchachra/Unlimited-OCR-AWQ

Download a single file to a local folder (e.g. README.md into ./dir)

Download a single file to a local folder (e.g. README.md into ./dir)
modelscope download --model sahilchachra/Unlimited-OCR-AWQ README.md --local_dir ./dir

See the docs for more CLI options

SDK Download

SDK Download
# 模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('sahilchachra/Unlimited-OCR-AWQ')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://www.modelscope.cn/sahilchachra/Unlimited-OCR-AWQ.git

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/sahilchachra/Unlimited-OCR-AWQ.git

ModelScope 模型页直接下载模型文件;无需将模型文件放在本站服务器。

Notebook Quickstart

Install the ModelScope library

Install the ModelScope library
pip install "modelscope[audio,cv,nlp,multi-modal,science]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

Load the model and run inference

Load the model and run inference
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

p = pipeline('text-generation', 'sahilchachra/Unlimited-OCR-AWQ')

Full Documentation

来源: HuggingFace

---
license: mit
base_model: baidu/Unlimited-OCR
base_model_relation: quantized
pipeline_tag: image-text-to-text
library_name: transformers
tags:
- awq
- int4
- w4a16
- compressed-tensors
- llm-compressor
- ocr
- deepseek-ocr
- vision-language
- multimodal
- image-text-to-text
- moe
- quantized
- document-parsing
language:
- multilingual
---

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

bash
pip install "transformers==4.57.3" compressed-tensors accelerate torch torchvision \
            einops addict easydict matplotlib pillow
python
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:

code
<|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.:

code
<|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.

Join our Telegram