Image-Text-to-Text
Transformers
Safetensors
qwen3_5
document-parsing
ocr
multilingual
mdpbench
qwen3.5
conversational
Instructions to use hitxhslhy/realocr with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hitxhslhy/realocr with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="hitxhslhy/realocr") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("hitxhslhy/realocr") model = AutoModelForMultimodalLM.from_pretrained("hitxhslhy/realocr", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use hitxhslhy/realocr with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hitxhslhy/realocr" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hitxhslhy/realocr", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/hitxhslhy/realocr
- SGLang
How to use hitxhslhy/realocr with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "hitxhslhy/realocr" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hitxhslhy/realocr", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "hitxhslhy/realocr" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hitxhslhy/realocr", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use hitxhslhy/realocr with Docker Model Runner:
docker model run hf.co/hitxhslhy/realocr
|
Download CHECKLIST.md from hitxhslhy/realocr: direct link, hf CLI and curl.
- Browser
- Download file 2.61 kB
-
https://huggingface.co/hitxhslhy/realocr/resolve/main/CHECKLIST.md
- Command line
-
hf download hf://hitxhslhy/realocr/CHECKLIST.md
-
curl -L -o CHECKLIST.md https://huggingface.co/hitxhslhy/realocr/resolve/main/CHECKLIST.md
2.61 kB
CHECKLIST — 用合并权重送 MDPBench 官方评测
按顺序做,打勾即可。
A. 上传(必做)
- 拿到上传 token(见
UPLOAD.md):HF Write token,或 ModelScope SDK 令牌。 - 先空跑确认 token 和目标账号(不上传任何东西):
python upload_hf.py --repo-id <账号>/Qwen3.5-2B-MDPBench-R7 --dry-run - 正式上传(本文件夹会原样变成仓库根目录,4.4 GB 需要一会儿):
python upload_hf.py --repo-id <账号>/Qwen3.5-2B-MDPBench-R7(或python upload_modelscope.py --repo-id <账号>/Qwen3.5-2B-MDPBench-R7) - 记下仓库 URL —— 它同时是官方要的「weight link」和「inference code」。
B. 上传后检查(必做)
- 仓库是 public(官方要能下载)。
- 仓库根目录有
model.safetensors(≈4.43 GB)、config.json、tokenizer.json、chat_template.jinja、processor_config.json。 - 根目录
README.md是 model card(展示在 HF 页面上)。 -
inference/infer_mdpbench.py能打开且内容完整。 - 本地拉一次自检:
bash python - <<'PY' from huggingface_hub import snapshot_download p = snapshot_download("<账号>/Qwen3.5-2B-MDPBench-R7", allow_patterns=["*.json", "*.jinja", "*.safetensors"]) print("ok:", p) PY
C. 附上的证据(已包含)
-
results/public_sub408.txt(Overall 77.3) -
results/public_sub1020.txt(Overall 77.4) -
results/scores.json
D. 提申请(必做)
- 用
SUBMISSION_TEMPLATE.md的正文,把<...>换成你的仓库 URL。 - 二选一提交: - GitHub issue:https://github.com/Yuliang-Liu/MultimodalOCR/issues - 邮件:zhangli123@hust.edu.cn
- 正文务必包含:权重链接 + 推理代码链接 + 推理设置
(greedy /
max_new_tokens=8192/ nativemax_pixels=16777216/ 官方 prompt /enable_thinking=False)。 - 说明「请用 Private Set 评测」。
E. 本机自检(已完成,见 VALIDATION.md)
- 合并权重的
config.json/safetensors完整,用infer_mdpbench.py真机跑通。 - 合并权重输出与 adapter 版输出高度一致(见
VALIDATION.md)。 - 推理脚本语法、prompt 与训练 prompt 逐字节一致。
想自己再跑一遍(有 GPU):
python inference/infer_mdpbench.py \
--model . --local-files-only \
--image-dir <MDPBench_img_public> --out-dir /tmp/smoke --limit 2