alt.freeweights.text / Unlimited-OCR
From: baidu <huggingface.co/baidu>Newsgroups: alt.freeweights.textSubject:

Unlimited-OCR

Date: 2026-11-15Commit: 8249d20Signed: 2DC28CC7B26A283B ✓

Image text to text model with 3.3B parameters. Safetensors weights, 13.5 GB in all. Published by baidu under MIT.

3.3B params13.5GBUnlimited-OCRsafetensorspermissive
FactsParams3.3BSize13.5 GBFormatssafetensorsTaskimage text to textLicenseMITFrom sourcepermissive
$ fw get baidu/Unlimited-OCR
# manifest sha256 0b2d20002922… · 13.5 GB · 24 files
$ fw verify ./Unlimited-OCR baidu/Unlimited-OCR
From sourceHosted (signed)baidu/Unlimited-OCRLast check: 2026-11-15 02:25 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Runs withAIBrixBentoMLCTranslate2ExLlamaV2ExLlamaV3exofastllmFlashInferKTransformersLitServeLMCacheLMDeployLocalAImistral.rsMLC LLMMooncakeSGLangText Generation WebUItinygradTransformersTriton Inference ServervLLMXinferenceFine-tune withAccelerateAlignment HandbookAxolotlColossal-AIDeepSpeedEasyR1FlashAttentionH2O LLM StudioJAXKerasLiger KernelLitGPTLLaMA-FactoryMegatron-LMms-swiftnanotronOLMo-coreOpenRLHFOumiPEFTPyTorch Lightningsd-scriptsSimpleTunerTorchTitantorchtuneTransformer EngineTRLUnslothverlConvert withAQLMAutoRoundCore ML ToolsExecuTorchGPTQModelLLM CompressormergekitNeural CompressorOliveONNXOptimum QuantoOptimumsafetensorsTensorRT Model OptimizertorchaoEvaluate withAutoevalsDeepEvalEvaluateHELMLightEvallm-evaluation-harnessOpenCompassOpikRagassimple-evalsSWE-benchTruLensWeaveScan withAgentDojoAI Fairness 360DeepTeamDetoxifyFairlearngarakGiskardGuardrailsMCP ScannerModelScanNeMo GuardrailspicklescanpromptfooWorks withAgent Development KitAG2Google AI Edge GalleryAiderany-llmAnythingLLMBAMLbrowser-useCAMELHugging Face Chat UIChatboxCherry StudioClineCodex CLICogneeCrewAIDeerFlowdocTRDSPyEasyOCREnchantedGemini CLIGitHub MCP ServergooseGPT ResearcherGradioGraphitiGuidanceHollamaInstructorKilo CodeLangflowLangGraphLiteLLMLlamaIndexLLMLocalAGILoLLMs WebUIMCP Python SDKMem0MetaGPTNextChatOllama JavaScriptOllama PythonolmOCROpenAI Agents SDKopencodeOpenHandsotermOutlinesPage AssistPlaywright MCPPortkey AI GatewayPrivateGPTQwen CodeRWKV RunnerSemantic KernelsmolagentsStrands AgentsSuryaVaneXGrammar

Overview

Size
13.5 GB
Weights
13.3 GB (safetensors)
Parameters
3.3B
Formats
safetensors
Task
image text to text
License
MIT (permissive)
Files
24, each with a sha256
Publisher
baidu
Added
2026-11-15
Section
alt.freeweights.text
Lineage

Original release from the publisher.

Where these bytes come from
Publisher at the pinned commitโ†’You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-15 02:25 UTCpassed

Model card

From the publisher at commit 8249d20. Shown as plain text with links; images open at the publisher.

Image: Baidu Inc.


Unlimited OCR Works#

baidu%2FUnlimited-OCR | Trendshift

GitHub Hugging Face

arXiv Twitter Follow

Welcome the Era of One-shot Long-horizon Parsing.#

Image: Unlimited OCR overview

Release#

  • [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#

Transformers#

Inference using Huggingface transformers on NVIDIA GPUs. Requirements tested on python 3.12.3 + CUDA12.9๏ผš

torch==2.10.0
torchvision==0.25.0
transformers==4.57.1
Pillow==12.1.1
matplotlib==3.10.8
einops==0.8.2
addict==2.4.0
easydict==1.13
pymupdf==1.27.2.2
psutil==7.2.2
import os
import torch
from transformers import AutoModel, AutoTokenizer

model_name = 'baidu/Unlimited-OCR'

tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModel.from_pretrained(
    model_name,
    trust_remote_code=True,
    use_safetensors=True,
    torch_dtype=torch.bfloat16,
)
model = model.eval().cuda()

# โ”€โ”€ Single image supports two configs: gundam or base โ”€โ”€
# gundam: base_size=1024, image_size=640, crop_mode=True
# base: base_size=1024, image_size=1024, crop_mode=False
model.infer(
    tokenizer,
    prompt='<image>document parsing.',
    image_file='your_image.jpg',
    output_path='your/output/dir',
    base_size=1024, image_size=640, crop_mode=True,
    max_length=32768,
    no_repeat_ngram_size=35, ngram_window=128,
    save_results=True,
)

# โ”€โ”€ Multi page / PDF only uses base (image_size=1024) โ”€โ”€
model.infer_multi(
    tokenizer,
    prompt='<image>Multi page parsing.',
    image_files=['page1.png', 'page2.png', 'page3.png'],
    output_path='your/output/dir',
    image_size=1024,
    max_length=32768,
    no_repeat_ngram_size=35, ngram_window=1024,
    save_results=True,
)

# โ”€โ”€ PDF (convert pages to images, then multi-page parsing) โ”€โ”€
import tempfile, fitz  # PyMuPDF

def pdf_to_images(pdf_path, dpi=300):
    doc = fitz.open(pdf_path)
    tmp_dir = tempfile.mkdtemp(prefix='pdf_ocr_')
    mat = fitz.Matrix(dpi / 72, dpi / 72)
    paths = []
    for i, page in enumerate(doc):
        out = os.path.join(tmp_dir, f'page_{i+1:04d}.png')
        page.get_pixmap(matrix=mat).save(out)
        paths.append(out)
    doc.close()
    return paths

model.infer_multi(
    tokenizer,
    prompt='<image>Multi page parsing.',
    image_files=pdf_to_images('your_doc.pdf', dpi=300),
    output_path='your/output/dir',
    image_size=1024,
    max_length=32768,
    no_repeat_ngram_size=35, ngram_window=1024,
    save_results=True,
)
vLLM#

Please refer to the official vLLM recipe for deployment details:

Recipe: https://recipes.vllm.ai/baidu/Unlimited-OCR

Docker Images#

Use the following Docker images depending on your GPU platform:

Default (CUDA 13.0):

docker pull vllm/vllm-openai:unlimited-ocr

For Hopper GPUs (CUDA 12.9)

docker pull vllm/vllm-openai:unlimited-ocr-cu129
SGLang#

Set up the environment (uv-managed virtualenv). Install the local SGLang wheel first, then pin kernels==0.9.0 and install PyMuPDF for PDF-to-image conversion:

uv venv --python 3.12
source .venv/bin/activate

uv pip install wheel/sglang-0.0.0.dev11416+g92e8bb79e-py3-none-any.whl
uv pip install kernels==0.11.7
uv pip install pymupdf==1.27.2.2

Start the SGLang server:

python -m sglang.launch_server \
    --model baidu/Unlimited-OCR \
    --served-model-name Unlimited-OCR \
    --attention-backend fa3 \
    --page-size 1 \
    --mem-fraction-static 0.8 \
    --context-length 32768 \
    --enable-custom-logit-processor \
    --disable-overlap-schedule \
    --skip-server-warmup \
    --host 0.0.0.0 \
    --port 10000

Send streaming requests to the OpenAI-compatible API:

import base64
import json
import os
import tempfile

import fitz
import requests
from sglang.srt.sampling.custom_logit_processor import DeepseekOCRNoRepeatNGramLogitProcessor

server_url = "http://127.0.0.1:10000"

session = requests.Session()
session.trust_env = False


def pdf_to_images(pdf_path, dpi=300):
    doc = fitz.open(pdf_path)
    tmp_dir = tempfile.mkdtemp(prefix="pdf_ocr_")
    mat = fitz.Matrix(dpi / 72, dpi / 72)
    image_paths = []
    for i, page in enumerate(doc):
        image_path = os.path.join(tmp_dir, f"page_{i + 1:04d}.png")
        page.get_pixmap(matrix=mat).save(image_path)
        image_paths.append(image_path)
    doc.close()
    return image_paths


def encode_image(image_path):
    ext = os.path.splitext(image_path)[1].lower()
    mime = "image/jpeg" if ext in (".jpg", ".jpeg") else f"image/{ext.lstrip('.')}"
    with open(image_path, "rb") as f:
        data = base64.b64encode(f.read()).decode("utf-8")
    return {"type": "image_url", "image_url": {"url": f"data:{mime};base64,{data}"}}


def build_content(prompt, image_paths):
    return [{"type": "text", "text": prompt}] + [encode_image(path) for path in image_paths]


def generate(prompt, image_paths, image_mode, ngram_window):
    payload = {
        "model": "Unlimited-OCR",
        "messages": [{"role": "user", "content": build_content(prompt, image_paths)}],
        "temperature": 0,
        "skip_special_tokens": False,
        "images_config": {"image_mode": image_mode},
        "custom_logit_processor": DeepseekOCRNoRepeatNGramLogitProcessor.to_str(),
        "custom_params": {
            "ngram_size": 35,
            "window_size": ngram_window,
        },
        "stream": True,
    }
    response = session.post(
        f"{server_url}/v1/chat/completions",
        headers={"Content-Type": "application/json"},
        data=json.dumps(payload),
        timeout=1200,
        stream=True,
    )
    response.raise_for_status()

    chunks = []
    for line in response.iter_lines(chunk_size=1, decode_unicode=True):
        if not line or not line.startswith("data: "):
            continue
        data = line[len("data: "):]
        if data == "[DONE]":
            break
        event = json.loads(data)
        delta = event["choices"][0].get("delta", {}).get("content", "")
        if delta:
            print(delta, end="", flush=True)
            chunks.append(delta)
    print()
    return "".join(chunks)


# Single image supports two configs: gundam or base. Example below uses gundam.
generate("document parsing.", ["your_image.jpg"], image_mode="gundam", ngram_window=128)

# Multi image (base only)
generate("Multi page parsing.", ["page1.png", "page2.png"], image_mode="base", ngram_window=1024)

# PDF (base only)
generate("Multi page parsing.", pdf_to_images("your_doc.pdf", dpi=300), image_mode="base", ngram_window=1024)

For OmniDocBench evaluation, you need to perform the following post-processing.

DET_RE = re.compile(r'<\|det\|>([^<\s]+)(?:\s*\[[^\]]*\])?\s*<\|/det\|>(.*)', re.DOTALL)

def remove_det(raw: str) -> str:
    """
    Strip <|det|>type [bbox]<|/det|> markers, group lines belonging to the
    same block with \\n, and separate different blocks with \\n\\n.
    """
    blocks = []
    cur = None
    for line in raw.splitlines():
        line = line.rstrip()
        if not line:
            continue
        m = DET_RE.match(line)
        if m:
            category, content = m.group(1).strip(), m.group(2).strip()
            if category == 'image':
                continue
            if cur is not None:
                blocks.append(cur)
            cur = [content] if content else []
            continue
        if cur is None:
            cur = []
        cur.append(line)
    if cur is not None:
        blocks.append(cur)
    text = '\n\n'.join('\n'.join(b) for b in blocks).strip()
    return text

Visualization#

Image: Long-horizon OCR demo

Acknowledgement#

We would like to thank Deepseek-OCR, Deepseek-OCR-2, PaddleOCR for their valuable models and ideas.

Citation#

@misc{yin2026unlimitedocrworks,
      title={Unlimited OCR Works}, 
      author={Youyang Yin and Huanhuan Liu and YY and Qunyi Xie and Chaorun Liu and Shiqi Yang and Shaohua Wang and Zhanlong Liu and Hao Zou and Jinyue Chen and Shu Wei and Jingjing Wu and Mingxin Huang and Zhen Wu and Guibin Wang and Tengyu Du and Lei Jia},
      year={2026},
      eprint={2606.23050},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2606.23050}, 
}

Files

24 files ยท 13.5 GBWeights 13.3 GB (safetensors). Sizes and sha256 from the signed manifest.
Show all 24 files with their sha256
FileSizesha256
.gitattributes302 B7e071dcfd64c09f9b9ff633ddc3ad878afa7c8ebdc8e7301cda90f5dbcd2dc9c
LICENSE1.06 KBd985048c6d69429d685fdbe7557340aa0897c0fd8dc038299b148b9c75dc3383
README.md11.1 KB4f573db255db5262bfe2ea92e459bfc11635a456f210e3a96289bb9605077a55
Unlimited-OCR.pdf460 KBd4cc0b2e98f53d9165e63af925519cccbf80ecc6f047973e3f9b2bdd84474a8b
assets/Unlimited-OCR.png106 KB77063289aecfedea40d90c94dac3bc5d57f42f65d2a988183bb665a69e26ce95
assets/baidu.png11.1 KB3342dd06c42f0abc227adf8e3a3602eda301adfb9af1371f22b9f40c6b5f3339
assets/long-horizon-ocr.gif82.2 MBd4ba8964d33ffa3a3584d4a1259625ab659c02190e9655ddd51793d28307d962
chat_template.jinja529 B690dcec206a691b4876d70db7092b6b0ae14cb8b51396e4c89a25b777f5a6830
config.json2.88 KB55e6c5179eea054a3fca99e3e41424649d22f574fba4c5f0737ef9c9095526e4
configuration_deepseek_v2.py10.7 KBb8470dd616ba8745fce6e27b093aef73a098863cc891b2477dcf9326a36000f7
conversation.py9.25 KBec7b6ce89bcda643de1f43269ffa66a7b2e65dc3ed30e427958f776546b4ba03
deepencoder.py38.0 KB0ae2fb6d1e5ae8cf100fc32f854830acd08c821a0a1f23a94a76588c222ddcf2
generation_config.json202 Bdc97b67afaad12b72320c4230f292be8cb5a73fcb4caa9072074fe5a341fb003
model-00001-of-000001.safetensors6.67 GB2bc48a7a110061ea58fff65d3169367eebe3aee371ca6968dc2219c1b2855fc6
model.safetensors6.67 GB2bc48a7a110061ea58fff65d3169367eebe3aee371ca6968dc2219c1b2855fc6
model.safetensors.index.json258 KB354be1f2dcfb72ebb385e25465522ce5413a77c36f3b35fec088a3162a11af99
modeling_deepseekv2.py90.2 KB74e36e6bd0ba7bc565ef76464a99baa8e6bccb710ae9c1007b54ac30b855fa4c
modeling_unlimitedocr.py53.4 KB3894696d68197ad00e89f0963880645dfce49b1933a9f27e78fbc05983547a78
preprocessor_config.json457 B62cef9e2db4ae494ff2ecccaedfeef884d8ba880c25d17f14e81f3d1c3c899cb
processor_config.json452 B2c82d81788aac5146db01d842138e8f5921daa907d2fd61c3c6c757d41dfb1d7
special_tokens_map.json801 Bab4bd57ce17d62e39e0a39e739de1e407484f090f0b2c7e391312bca7a5b061a
tokenizer.json9.98 MBa02f8fd5228c90256bb4f6554c34a579d48f909e5beb232dc4afad870b55a8b4
tokenizer_config.json166 KBa0cbe8464049da1f891b7a12676de06af4cb54c130995d42f71adc1c30c6e9f3
wheel/sglang-0.0.0.dev11416+g92e8bb79e-py3-none-any.whl12.5 MB2644a1f349c55f0ca822e70a70679c98475754ec4722c3be1b18a72bac477cd5
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
8249d20b28 pinned now2026-11-15 02:25 UTC24 files ยท 13.5 GB

Use it

$ fw get baidu/Unlimited-OCR
# manifest sha256 0b2d20002922… · 13.5 GB · 24 files
$ fw verify ./Unlimited-OCR baidu/Unlimited-OCR
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/baidu/Unlimited-OCR.json --dir ./Unlimited-OCR $ python3 fw.py verify ./Unlimited-OCR ./baidu__Unlimited-OCR.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download baidu/Unlimited-OCR --revision 8249d20b2822a7d8a4c22c8d8c9069b5ac36bda3 --local-dir ./Unlimited-OCR
transformersLoad the weights in Python.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from transformers import AutoModelForImageTextToText, AutoProcessor processor = AutoProcessor.from_pretrained("baidu/Unlimited-OCR", revision="8249d20b2822a7d8a4c22c8d8c9069b5ac36bda3") model = AutoModelForImageTextToText.from_pretrained("baidu/Unlimited-OCR", revision="8249d20b2822a7d8a4c22c8d8c9069b5ac36bda3", device_map="auto")
vLLMServe an OpenAI-compatible API.
$ HF_ENDPOINT=https://freeweights.allternit.com vllm serve baidu/Unlimited-OCR --revision 8249d20b2822a7d8a4c22c8d8c9069b5ac36bda3

License

Name
MIT License
Id
MIT
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-15
Text in
LICENSE
Text sha256
d985048c6d69429d685fdbe7557340aa0897c0fd8dc038299b148b9c75dc3383
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: baidu <huggingface.co/baidu>Newsgroups: alt.freeweights.textSubject: Unlimited-OCRDate: 2026-11-15Commit: 8249d20Signed: 2DC28CC7B26A283B ✓
Upstream
baidu/Unlimited-OCR
Pinned commit
8249d20b2822a7d8a4c22c8d8c9069b5ac36bda3
Manifest
Unlimited-OCR.json ยท .minisig
Manifest sha256
0b2d2000292282612f9ed21f4bedc02338a9ddc0b1adf3a97a45c16cf914a85c
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-15 02:25 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/baidu/Unlimited-OCR.json $ curl -O https://freeweights.allternit.com/manifests/baidu/Unlimited-OCR.json.minisig $ minisign -Vm Unlimited-OCR.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

2 models in the catalog name this one as their parent.

Quantizations
2
Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download baidu/Unlimited-OCR
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. Unlimited-OCR.json. Provenance. Takedown history: none.

Variants

2 quantized or adapter builds of Unlimited-OCR. Each has its own license check and page.

From: laion <huggingface.co/laion>Subject: a2-rl-e2egit_large-50-32B
From: laion <huggingface.co/laion>Subject: a3-rl-DCAgent_exp_rpt_e2egit-large-15-8B
From: laion <huggingface.co/laion>Subject: a3-rl-DCAgent_exp_rpt_e2egit-v2-10-8B
From: laion <huggingface.co/laion>Subject: a3-rl-DCAgent_exp_rpt_pymethods2test-large-80-8B
From: laion <huggingface.co/laion>Subject: a3-rl-DCAgent_exp_rpt_unitsyn-python-large-10-8B
From: laion <huggingface.co/laion>Subject: a3-rl-DCAgent_mix_h2_language_proportional-65-8B