AI SeedbankHelp preserve open and free AI for humanity's future

← All models

tencent_HunyuanOCR

tencent · View on Hugging Face ↗

Get this model

Download TorrentMagnet Link

Seeders: · Leechers:

Model card

The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.


license: other license_name: tencent-hunyuan-community license_link: https://huggingface.co/tencent/HunyuanOCR/blob/main/LICENSE language:

  • multilingual
  • en
  • zh tags:
  • ocr
  • vision-language-model
  • document-parsing
  • text-spotting
  • information-extraction
  • text-image-translation pipeline_tag: image-text-to-text library_name: transformers

HunyuanOCR-1.5: Making Lightweight OCR VLMs Faster and Better

🤗 HF Model | 💻 GitHub Repo | 📄 Paper

📦 Model layout. This repository hosts HunyuanOCR-1.5 checkpoint at the root (target base weights). The DFlash speculative-decoding draft lives under dflash/, and the previous HunyuanOCR-1.0 is archived under v1.0/ (load it with subfolder="v1.0", or download the v1.0/ directory directly).


📖 Introduction

HunyuanOCR-1.5 is a lightweight, end-to-end OCR-specialized vision-language model. It targets a broad range of text-centric visual tasks and unifies document parsing, text spotting, information extraction, text-image translation within a single end-to-end VLM.

Building upon the validated lightweight architecture of HunyuanOCR-1.0, HunyuanOCR-1.5 does not redesign the model backbone. Instead, it performs a systematic upgrade around two goals — making the model faster and better:

  • Faster — DFlash inference acceleration. End-to-end OCR is often accompanied by long autoregressive decoding, which becomes the major bottleneck for dense documents, tables, formulas, and other long structured outputs. HunyuanOCR-1.5 adapts a speculative-decoding framework based on DFlash: a lightweight block-diffusion draft model drafts multiple candidate tokens in parallel, which are then verified by the target model in a single pass. This significantly reduces the decoding latency of long structured outputs while preserving the output distribution of the target model.
  • 💻 PC-side deployment via llama.cpp. Beyond server-grade vLLM, HunyuanOCR-1.5 also supports CPU / consumer-GPU / laptop deployment through llama.cpp with a GGUF-converted checkpoint and an OpenAI-compatible llama-server. A DFlash-adapted llama.cpp fork is provided as well, so the same speculative-decoding acceleration is available on PC.
  • 🧠 Better — Agentic Data Flow + upgraded training recipe. On the data side, we propose Agentic Data Flow, an agent-driven data-construction system that translates model weaknesses into executable data requirements. Agents deeply participate in material search, tool-based verification, sample cleaning, and data-pipeline development, and iterate in a closed loop with algorithm engineers. In HunyuanOCR-1.5, this system is used for targeted long-tail capabilities such as low-resource OCR, ancient-script OCR, and multi-image text-centric QA. On the training side, we systematically upgrade the recipe: pretraining Stage-3 is re-planned to incorporate the newly produced capability data, multi-image data, and historical OCR data, with maximum image resolution extended to 4K and context window extended to 128K; post-training refines the SFT data and further explores RL across different OCR tasks to amplify the gains from reinforcement learning.

Together, HunyuanOCR-1.5 achieves both faster inference and broader OCR capability coverage while retaining the deployment advantages of a lightweight end-to-end model. The full SFT / DFlash training pipeline and the transformers / vLLM / llama.cpp inference stack are open-sourced in the GitHub repo.


⚙️ Environment

Inference now uses a single unified environment (built on uv, requires CUDA 13) that runs all three configurations from the same install: vLLM AR, DFlash speculative decoding, and native transformers. Accuracy alignment across the three has been verified.

pip install uv
uv venv --python 3.12.11 && source .venv/bin/activate
uv pip install "vllm>=0.25.1"
uv pip install --no-build-isolation --no-cache-dir "flash-attn==2.8.3"

The inference code lives on GitHub under inference/ (inference/vLLM, inference/DFlash, inference/transformers). See docs/inference/inference.md for the full setup and usage. If you lack CUDA 13 or only need one configuration, that document also points to the lighter per-configuration recipes in the archive.

Common prerequisites: Python 3.10+ (3.12 tested), an NVIDIA GPU, and huggingface_hub for downloading the weights:

pip install -U "huggingface_hub[cli]"
# target base (1.5) — skip the archived 1.0 to save space
huggingface-cli download tencent/HunyuanOCR --local-dir ./HunyuanOCR --exclude "v1.0/*"

The download contains both the base model and the dflash/ draft model.


🧪 Inference

All configurations share the same weights and the same task-type prompts + sampling (temperature=0.0, top_p=1.0, top_k=-1, repetition_penalty=1.08) + post-processing, so their outputs are directly comparable. Grab the toolkit from GitHub first:

git clone https://github.com/Tencent-Hunyuan/HunyuanOCR.git
cd HunyuanOCR

A. HuggingFace transformers (native)

The model ships the official HunYuanVLForConditionalGeneration + AutoProcessor integration (transformers ≥ 5.13.0). The simplest path — weights are pulled from the Hub automatically:

import torch
from transformers import AutoProcessor, HunYuanVLForConditionalGeneration

MODEL_ID = "tencent/HunyuanOCR"

processor = AutoProcessor.from_pretrained(MODEL_ID, trust_remote_code=True, use_fast=False)
model = HunYuanVLForConditionalGeneration.from_pretrained(
    MODEL_ID, torch_dtype=torch.bfloat16, device_map="auto",
    trust_remote_code=True,
).eval()

prompt = (
    "提取文档图片中正文的所有信息用markdown格式表示,其中页眉、页脚部分忽略,"
    "表格用html格式表达,文档中公式用latex格式表示,按照阅读顺序组织进行解析。"
)
messages = [{
    "role": "user",
    "content": [
        {"type": "image", "image": "/path/to/document.png"},
        {"type": "text",  "text":  prompt},
    ],
}]
inputs = processor.apply_chat_template(
    messages, add_generation_prompt=True, tokenize=True,
    return_dict=True, return_tensors="pt",
).to(model.device)
with torch.inference_mode():
    out = model.generate(**inputs, max_new_tokens=8000, do_sample=False)
gen = out[:, inputs["input_ids"].shape[1]:]
print(processor.batch_decode(gen, skip_special_tokens=True)[0])

For multi-GPU batch inference with sampling / early-stop / doc-parse normalization strictly aligned to the vLLM client, use the shipped script after installing the unified environment (see docs/inference/inference.md):

python inference/transformers/infer_hf_8gpu.py \
    --model ./HunyuanOCR --attn-implementation flash_attention_2 \
    --input ./input.jsonl --output ./results/hf_out \
    --gpu-ids 0,1,2,3,4,5,6,7 --max-new-tokens 32768 \
    --merge

B. vLLM (OpenAI-compatible)

The unified environment (installed as shown above) serves the model as tencent/HunyuanOCR with -tp 1 and --max-model-len 131072, and supports both plain autoregressive (AR) decoding and DFlash speculative decoding from the same install.

AR (baseline). Launch the vLLM server:

MODEL_PATH=./HunyuanOCR GPU=0 PORT=8000 bash inference/vLLM/serve.sh
curl -sf http://127.0.0.1:8000/v1/models     # readiness check

DFlash (speculative decoding). The DFlash draft ships under the dflash/ subfolder of tencent/HunyuanOCR, so it is already inside ./HunyuanOCR after the huggingface-cli download above. serve_DFlash.sh defaults DFLASH_PATH to ${MODEL_PATH}/dflash, so no manual copy is needed:

MODEL_PATH=./HunyuanOCR GPU=0 PORT=8000 bash inference/DFlash/serve_DFlash.sh

Client (either mode). Send one image with the shipped client. The prompt is locked to an official task type via --task-type (run --list-tasks to see all); sampling and streaming tail-repetition early-stop / cleanup are built in:

python inference/vLLM/infer_vllm_client.py \
    --host 127.0.0.1 --port 8000 \
    --model tencent/HunyuanOCR \
    --image /path/to/document.png \
    --task-type doc_parse \
    --max-tokens 32768

# add --no-stream            to disable streaming + early-stop
# add --no-doc-postprocess   to disable doc_parse markdown normalization

Available task types (--task-type): doc_parse (default), structured_parse, spotting_json, spotting_hunyuan, layout, layout_parse, chart_parse, formula, table, doc_trans_en2zh, trans_other2en, trans_other2zh.

For batch inference over a directory (same task types, multi-endpoint concurrency, resumable):

python inference/vLLM/batch_infer.py \
    --image-dir /path/to/images \
    --out-dir /path/to/output \
    --ports 8000 \
    --task-type doc_parse \
    --max-tokens 32768 \
    --concurrency 16

Or hand-written with the OpenAI SDK:

import base64
from openai import OpenAI

def data_url(p):  # Mime is fixed to image/jpeg
    return f"data:image/jpeg;base64,{base64.b64encode(open(p,'rb').read()).decode()}"

client = OpenAI(api_key="EMPTY", base_url="http://127.0.0.1:8000/v1")
resp = client.chat.completions.create(
    model="tencent/HunyuanOCR",
    messages=[
        {"role": "system", "content": ""},
        {"role": "user", "content": [
            {"type": "image_url", "image_url": {"url": data_url("/path/to/document.png")}},
            {"type": "text", "text": "请提取图片中的文字内容。"},
        ]},
    ],
    max_tokens=32768,
    temperature=0.0, top_p=1.0,
    extra_body={"top_k": -1, "repetition_penalty": 1.08, "skip_special_tokens": True},
)
print(resp.choices[0].message.content)

C. PC-side deployment via llama.cpp

For CPU / consumer-GPU / laptop environments, HunyuanOCR-1.5 can also be deployed through llama.cpp after converting the checkpoint to GGUF. Both the community llama.cpp (HunyuanOCR base only) and a DFlash-adapted fork (wendadawen/llama.cpp @ dflash-adapt-hunyuanocr-hunyuanstyle) are supported.

Minimal build & serve (community, no DFlash):

# 1. Build
git clone https://github.com/ggml-org/llama.cpp.git && cd llama.cpp
cmake -B build -DLLAMA_BUILD_EXAMPLES=ON   # add -DGGML_CUDA=ON for NVIDIA GPU
cmake --build ./build --config Release -j

# 2. Convert HunyuanOCR to GGUF (base + mmproj)
hf download tencent/HunyuanOCR --local-dir ./HunyuanOCR --exclude "v1.0/*"
python3 convert_hf_to_gguf.py --outfile ./HunyuanOCR/hyocr-f16.gguf --outtype f16 ./HunyuanOCR
python3 convert_hf_to_gguf.py --outfile ./HunyuanOCR/mmproj-hyocr-f16.gguf --outtype f16 --mmproj ./HunyuanOCR

# 3. Serve (OpenAI-compatible)
build/bin/llama-server \
  --model ./HunyuanOCR/hyocr-f16.gguf \
  --mmproj ./HunyuanOCR/mmproj-hyocr-f16.gguf \
  --host 0.0.0.0 --port 8080 --alias HYVL \
  --ctx-size 10240 --n-predict 4096

The DFlash-adapted variant and the full guide are in docs/llama_cpp.md in the GitHub repo.


🎯 Default OCR prompt for document parsing

提取文档图片中正文的所有信息用markdown格式表示,其中页眉、页脚部分忽略,表格用html格式表达,文档中公式用latex格式表示,按照阅读顺序组织进行解析。

The model also handles text spotting, information extraction, and text-image translation — pass a task-specific instruction as the text prompt (or use --task-type with the shipped client).


🔗 Related resources

  • GitHub — training & inference toolkit: https://github.com/Tencent-Hunyuan/HunyuanOCR
  • verl-based RL training stack (GRPO on HunyuanOCR-1.5): train_verl/
  • DFlash draft weights: tencent/HunyuanOCR/dflash
  • HunyuanOCR-1.0 (previous generation, archived under v1.0/): tencent/HunyuanOCR/v1.0

🙏 Acknowledgements

We would like to thank Qwen and DFlash for their valuable models and ideas.

Special thanks to the Hugging Face community for their Day-0 support.


📜 License

HunyuanOCR-1.5 is released under the same license as HunyuanOCR 1.0 — the Tencent Hunyuan Community License Agreement. See LICENSE for the full terms.


📚 Citation

@article{HunyuanOCR_1_5_2026,
  title   = {{HunyuanOCR-1.5}: Making Lightweight {OCR} {VLMs} Faster and Better},
  author  = {Li, Gengluo and Wan, Xingyu and Peng, Shangpin and Wang, Weinong and Feng, Hao and Du, Yongkun and Wu, Binghong and Ruan, Zheng and Lu, Zhiqiong and Wu, Liang and Lyu, Pengyuan and Shen, Huawen and Lin, Zibin and Hu, Shijing and Yang, Jieneng and Wen, Hongbing and Yu, Guanghua and Liu, Hong and Wang, Bochao and Ma, Can and Hu, Han and Zhang, Chengquan and Zhou, Yu},
  journal = {arXiv preprint arXiv:2607.04884},
  year    = {2026}
}

Magnet link

Opens the swarm directly in your torrent client — no file download needed. Copy-paste works too:

magnet:?xt=urn:btih:8b9a86ed8d56bd74991afbc7539066bf4c015231&dn=tencent_HunyuanOCR

Open magnet in torrent client · infohash 8b9a86ed8d56bd74991afbc7539066bf4c015231

Files & hashes

PathSizesha1sha256
LICENSE15.9 KB (16,277 B)f1d5a0983b3d3b588a1378ef60c788ba3c654c4f745adaa59575d2a98b64fd6d3452537b477a6b6edc126f742fc055313cc3d3e0
README.md13.7 KB (14,075 B)56fd6e60ae048c72884ab76a2d7754778582f2b47e5438581036dfb8909120812d8605f534149bcf568c8ec76bd2ad3d9e18bb6c
assets/HyOCR_1_5_teaser.png1.6 MB (1,713,948 B)b0e2f88f417cb2329f5f6cc0a6a875858fc11747ec7042ae514e22c3b422ba7ad960b61e2ea3a585c6559ed2259b22de2302874f
chat_template.jinja994 B (994 B)5cab73f2215d04b8eb87b9b20b74ab62ba28edcabe3371395b9e67a8f981d86543eb5a93d132a1dc3f54058a2d75b4ed1efc73fe
config.json2.2 KB (2,233 B)59b5ebaa52f7e3de8e34b4df4115506643011a7e14aeb192e94fbe9c3ec71fb7ed003955397be08eb4b345dd7b923549798b60ba
dflash/README.md5.4 KB (5,506 B)f269a902211cfc843241c6f16e66d3949554af51dbeef5f2e037d28a9526c7759b6c440ea8a6f6d2b789cb84ba9cc59ccc4c9182
dflash/chat_template.jinja994 B (994 B)5cab73f2215d04b8eb87b9b20b74ab62ba28edcabe3371395b9e67a8f981d86543eb5a93d132a1dc3f54058a2d75b4ed1efc73fe
dflash/config.json1.1 KB (1,086 B)784b7b9fc3727547685e0b3da22d21e5c97181f93e998e89221d42b25610f074891083f18cfe1d3bdfc2b02a07cd5c1ddccd7804
dflash/dflash.py8.1 KB (8,345 B)74d3ee2a48fbb1e65e25e19ab6cd89e2b28cd12080d58268f8839a22cad42516cc95d127b79fca194d25ee7a8cc4d610bc8f560e
dflash/model.safetensors346.1 MB (362,867,640 B)1f003acce0f945f098547a3017623961ccddc07f9b189f2c0d2b0251d697c19790c2a9b5416da5fc2981edfaab9673ac76b5d513
dflash/processor_config.json1.4 KB (1,443 B)a1107ec674029c95eaf8a352e194c276bdce9e530c43a267783205c347458041fe930227e9db80c3a62adb6a81bed0e599918855
dflash/tokenizer.json9.1 MB (9,527,297 B)063f94b7e5680b7c3da136d8f20676bfcf730aab3e2ab46bcc5ed8bce013b245c6daecf19fa1d2a18f48a9c88a1f571dcbf7dfd3
dflash/tokenizer_config.json1.1 KB (1,165 B)3b78e51a4733bbd381fdddb30a9a33d053e425a1a620905ede57b3267c8821b0d3e889483b54c7eb61459cb731d92876e23bb619
generation_config.json139 B (139 B)0148a66f6846fe10f4baef9d35e736d1a78182cbe9f4d443b97de6cb40767d12b5fc045a5ca3fb6d2f911124fce307bfbe1ad585
model.safetensors2.09 GB (2,239,932,512 B)9d2bd53133f17e150cb308bdecac1d5ebebe588d632a1e082c4dd5a3284cf1ffcdba2fdaa06f435762c58c2f34aff0f3bd6c0249
preprocessor_config.json579 B (579 B)f22dd929529af0c3bb04d273a7c63395b15f7275e17baf5f25f542380a3a8231fefa08f359d86db1ac088feb12ecb8b06ddb01c3
special_tokens_map.json836 B (836 B)32ace9cb4ca914cb94c793e6fed6ce1fcf447b9671442c8c43669f4cedd669f1700f89a741773c49aef55783fbd533f72f050c92
tokenizer.json9.1 MB (9,527,297 B)063f94b7e5680b7c3da136d8f20676bfcf730aab3e2ab46bcc5ed8bce013b245c6daecf19fa1d2a18f48a9c88a1f571dcbf7dfd3
tokenizer_config.json162.7 KB (166,592 B)3b04ad5ddf7203fc39d80a65bc9b51cb609c8b43804e8a7fb5a129afb19f6ad88c51c5d3c1aa643b6abb9536d10bcdcf633b4d74
v1.0/LICENSE15.9 KB (16,277 B)f1d5a0983b3d3b588a1378ef60c788ba3c654c4f745adaa59575d2a98b64fd6d3452537b477a6b6edc126f742fc055313cc3d3e0
v1.0/README.md10.3 KB (10,540 B)0ce04424a786aaaa9393caf35e017203b6760d6534ba884d7c8083e6be678937bdcecd0354dd13c3879df89fd3abfee56293b6ca
v1.0/config.json1.8 KB (1,893 B)ba15ed7b171336aa60e4188069760f8f7969a3de57d825203dbe1317eab32d16dc8b36c06892062765e9c5718dd740ab936cc245
v1.0/generation_config.json205 B (205 B)309b1a88b5a5c17c4f6c604bb07bb86770923dce695e9d7daab7e1f9e6dd9efa01cad847f585f4c4504c67baca99323b27b9e77f
v1.0/model-00001-of-00004.safetensors419.2 MB (439,600,816 B)327faf720f56f6dd4c6fc5a20a093dc80fdaf38ae7a0f4cb7fdfe4dc2686f8554310a34b4859ae464ec948f89d954318e382382d
v1.0/model-00002-of-00004.safetensors432.3 MB (453,346,288 B)2ee27d616b239aa1a24fe0042884e39e7331ba1efbfd70bed291d7920c65aacf4f07c8ea55e60dda253a529860880c5a7e4c00bd
v1.0/model-00003-of-00004.safetensors440.2 MB (461,590,008 B)40b9c1c37ffb16c10c90993971c85aa330e1ffeb53d0b9f9a85aa21b3454f16f19845294fff7bab8e13aeaf3f7992b85fd35c473
v1.0/model-00004-of-00004.safetensors608.4 MB (637,958,736 B)948ed09837ced04ea145a3bb2d690426eb18191ffd82d09583ee16037f04532808d0f00332301fc6ed18aa0b75b902fa014402aa
v1.0/model.safetensors.index.json56.9 KB (58,249 B)34d50fb4758e403e0717abfb7b28ccaf942f78c595bbfecda15d05905ec85fc32ada5c6c4867952b5b379d85a2208c7e050a5cf6
v1.0/preprocessor_config.json370 B (370 B)9fd78f0b7b9c59a54144c39d973ba91cad6670f7bb37f765bf675500b9a8de70a27b1d973347ee1315c7abbfd231783b64a2f322
v1.0/special_tokens_map.json146 B (146 B)0e501fd4c9b4d06fcbb9b89ca87a3d8d663211b5eb0954f10121cee77ba00c41d4b2715880c81a3356c98bb513045dc9fb556c22
v1.0/tokenizer.json5.8 MB (6,054,315 B)1943bfad0554879d54b488eb6a38b8b3c6281832cde511cfdf641d7340731f174362d6ab7329ac4b7543cf41f42457aa84e25484
v1.0/tokenizer_config.json163.2 KB (167,145 B)0afe044979e2c40a08f70baff042ae28ab54d5155c17a71d2cf4bc0663d01f756fdbb9280691d1ba77c838a9727291b82ae36c3c
video_preprocessor_config.json916 B (916 B)9e5749cbe26651b79620a9fce55d254bf4e2abfef0b9fba99cdc7d556adb3a9023f961534d46c1b7c84b31c6684d8562cd866b79

Cite this release

Canonical URL
https://aiseedbank.org/models/tencent_HunyuanOCR/
Slug
tencent_HunyuanOCR
Infohash
8b9a86ed8d56bd74991afbc7539066bf4c015231
License
custom/other license
Signing key fingerprint
85a3b32c3712427b

Every file carries a locally computed sha256 — verify a download against the signed sums: tencent_HunyuanOCR.SHA256SUMS (+ minisign signature).

Provenance

Upstream repositorytencent/HunyuanOCR
Revision (pinned)47644ecc4fc854efa4f505155158831f36773ee4
Fetched at2026-09-04T06:30:26Z
License at fetchother
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

✓ verified · rehash-vs-hf-metadata at 2026-09-04T06:31:09Z

custom/other license4.31 GB (4,622,594,862 bytes)transformerssafetensorshunyuan_vlimage-text-to-textocrvision-language-modeldocument-parsingtext-spottinginformation-extractiontext-image-translationconversationalmultilingualeval-resultsendpoints_compatible2 languages (en, zh)paper: 2607.04884