Image-Text-to-Text
Transformers
Safetensors
qwen3_5
document-parsing
infinity-parser
conversational
Eval Results
Instructions to use chipherndon/Infinity-Parser2-Flash-vllm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use chipherndon/Infinity-Parser2-Flash-vllm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="chipherndon/Infinity-Parser2-Flash-vllm") 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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("chipherndon/Infinity-Parser2-Flash-vllm") model = AutoModelForMultimodalLM.from_pretrained("chipherndon/Infinity-Parser2-Flash-vllm", 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use chipherndon/Infinity-Parser2-Flash-vllm with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "chipherndon/Infinity-Parser2-Flash-vllm" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chipherndon/Infinity-Parser2-Flash-vllm", "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/chipherndon/Infinity-Parser2-Flash-vllm
- SGLang
How to use chipherndon/Infinity-Parser2-Flash-vllm 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 "chipherndon/Infinity-Parser2-Flash-vllm" \ --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": "chipherndon/Infinity-Parser2-Flash-vllm", "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 "chipherndon/Infinity-Parser2-Flash-vllm" \ --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": "chipherndon/Infinity-Parser2-Flash-vllm", "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 chipherndon/Infinity-Parser2-Flash-vllm with Docker Model Runner:
docker model run hf.co/chipherndon/Infinity-Parser2-Flash-vllm
Commit ·
4368c9c
0
Parent(s):
Duplicate from infly/Infinity-Parser2-Flash
Browse filesCo-authored-by: Zuming Huang <zuminghuang@users.noreply.huggingface.co>
- .eval_results/parsebench.yaml +60 -0
- .gitattributes +37 -0
- README.md +596 -0
- assets/logo.png +0 -0
- chat_template.jinja +154 -0
- config.json +106 -0
- model.safetensors +3 -0
- processor_config.json +63 -0
- tokenizer.json +3 -0
- tokenizer_config.json +32 -0
.eval_results/parsebench.yaml
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
- dataset:
|
| 2 |
+
id: llamaindex/ParseBench
|
| 3 |
+
task_id: mean
|
| 4 |
+
value: 73.25
|
| 5 |
+
date: '2026-05-15'
|
| 6 |
+
source:
|
| 7 |
+
url: https://huggingface.co/datasets/llamaindex/ParseBench
|
| 8 |
+
name: ParseBench
|
| 9 |
+
user: boyang-runllama
|
| 10 |
+
notes: "Pipeline name: infinity_parser2_flash"
|
| 11 |
+
- dataset:
|
| 12 |
+
id: llamaindex/ParseBench
|
| 13 |
+
task_id: text_content
|
| 14 |
+
value: 89.52
|
| 15 |
+
date: '2026-05-15'
|
| 16 |
+
source:
|
| 17 |
+
url: https://huggingface.co/datasets/llamaindex/ParseBench
|
| 18 |
+
name: ParseBench
|
| 19 |
+
user: boyang-runllama
|
| 20 |
+
notes: "Pipeline name: infinity_parser2_flash"
|
| 21 |
+
- dataset:
|
| 22 |
+
id: llamaindex/ParseBench
|
| 23 |
+
task_id: text_formatting
|
| 24 |
+
value: 57.7
|
| 25 |
+
date: '2026-05-15'
|
| 26 |
+
source:
|
| 27 |
+
url: https://huggingface.co/datasets/llamaindex/ParseBench
|
| 28 |
+
name: ParseBench
|
| 29 |
+
user: boyang-runllama
|
| 30 |
+
notes: "Pipeline name: infinity_parser2_flash"
|
| 31 |
+
- dataset:
|
| 32 |
+
id: llamaindex/ParseBench
|
| 33 |
+
task_id: layout
|
| 34 |
+
value: 80.61
|
| 35 |
+
date: '2026-05-15'
|
| 36 |
+
source:
|
| 37 |
+
url: https://huggingface.co/datasets/llamaindex/ParseBench
|
| 38 |
+
name: ParseBench
|
| 39 |
+
user: boyang-runllama
|
| 40 |
+
notes: "Pipeline name: infinity_parser2_flash"
|
| 41 |
+
- dataset:
|
| 42 |
+
id: llamaindex/ParseBench
|
| 43 |
+
task_id: chart
|
| 44 |
+
value: 55.56
|
| 45 |
+
date: '2026-05-15'
|
| 46 |
+
source:
|
| 47 |
+
url: https://huggingface.co/datasets/llamaindex/ParseBench
|
| 48 |
+
name: ParseBench
|
| 49 |
+
user: boyang-runllama
|
| 50 |
+
notes: "Pipeline name: infinity_parser2_flash"
|
| 51 |
+
- dataset:
|
| 52 |
+
id: llamaindex/ParseBench
|
| 53 |
+
task_id: table
|
| 54 |
+
value: 82.88
|
| 55 |
+
date: '2026-05-15'
|
| 56 |
+
source:
|
| 57 |
+
url: https://huggingface.co/datasets/llamaindex/ParseBench
|
| 58 |
+
name: ParseBench
|
| 59 |
+
user: boyang-runllama
|
| 60 |
+
notes: "Pipeline name: infinity_parser2_flash"
|
.gitattributes
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
assets/example_1.png filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,596 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
- zh
|
| 6 |
+
- multilingual
|
| 7 |
+
pipeline_tag: image-text-to-text
|
| 8 |
+
library_name: transformers
|
| 9 |
+
tags:
|
| 10 |
+
- ocr
|
| 11 |
+
- pdf
|
| 12 |
+
- document-parsing
|
| 13 |
+
- document-understanding
|
| 14 |
+
- layout-analysis
|
| 15 |
+
- table-recognition
|
| 16 |
+
- chart-parsing
|
| 17 |
+
- formula-recognition
|
| 18 |
+
- chemical-formula
|
| 19 |
+
- markdown
|
| 20 |
+
- vision-language
|
| 21 |
+
- infinity-parser
|
| 22 |
+
- infinity_parser2
|
| 23 |
+
datasets:
|
| 24 |
+
- infly/Infinity-Doc2-5M
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
# Infinity-Parser2-Flash
|
| 28 |
+
|
| 29 |
+
<p align="center">
|
| 30 |
+
<img src="assets/logo.png" width="400"/>
|
| 31 |
+
<p>
|
| 32 |
+
|
| 33 |
+
<p align="center">
|
| 34 |
+
💻 <a href="https://github.com/infly-ai/INF-MLLM">Github</a> |
|
| 35 |
+
📊 <a href="https://huggingface.co/datasets/infly/Infinity-Doc2-5M">Dataset</a> |
|
| 36 |
+
📄 <a href="https://arxiv.org/pdf/2607.07836">Paper</a> |
|
| 37 |
+
🚀 <a href="https://huggingface.co/spaces/infly/Infinity-Parser2-Demo">Demo</a>
|
| 38 |
+
</p>
|
| 39 |
+
|
| 40 |
+
## News
|
| 41 |
+
|
| 42 |
+
- [2026-05-11] Released flagship document parsing models: [Infinity-Parser2-Pro](https://huggingface.co/infly/Infinity-Parser2-Pro), [Infinity-Parser2-Flash](https://huggingface.co/infly/Infinity-Parser2-Flash), and the dataset [Infinity-Doc2-5M](https://huggingface.co/datasets/infly/Infinity-Doc2-5M). Infinity-Parser2 achieves SOTA results on olmOCR-bench and ParseBench.
|
| 43 |
+
|
| 44 |
+
<p align="center">
|
| 45 |
+
<img src="https://raw.githubusercontent.com/infly-ai/INF-MLLM/main/Infinity-Parser2/assets/newspaper_1.png" width="1200"/>
|
| 46 |
+
</p>
|
| 47 |
+
|
| 48 |
+
## Introduction
|
| 49 |
+
|
| 50 |
+
We are excited to release Infinity-Parser2, our latest flagship document understanding model. We offer two distinct variants to address diverse deployment constraints: Infinity-Parser2-Pro, optimized for maximum accuracy in precision-critical tasks, achieves state-of-the-art results on olmOCR-Bench (87.6%) and ParseBench (74.3%), surpassing frontier models including DeepSeek-OCR-2, PaddleOCR-VL-1.5, and MinerU2.5. Infinity-Parser2-Flash, engineered for low-latency inference, delivers a 3.68x speedup over our previous Infinity-Parser-7B model. With significant upgrades to both our data engine and multi-task reinforcement learning approach, the model consolidates robust multi-modal parsing capabilities into a unified architecture, unlocking brand-new zero-shot capabilities across a wide range of real-world business scenarios.
|
| 51 |
+
|
| 52 |
+
### Key Features
|
| 53 |
+
|
| 54 |
+
- **Upgraded Data Engine**: We have comprehensively enhanced our synthetic data engine to support both fixed-layout and flexible-layout document formats. By curating nearly 5 million diverse document parsing samples across a wide range of layouts, combined with a dynamic adaptive sampling strategy, we ensure highly balanced and robust multi-task learning across various document types.
|
| 55 |
+
- **Multi-Task Reinforcement Learning**: We designed a novel verifiable reward system to support Joint Reinforcement Learning (RL), enabling seamless and simultaneous co-optimization of multiple complex tasks, including document parsing, element parsing, chart parsing, chemical formula parsing, document vqa, and general multimodal understanding.
|
| 56 |
+
- **Breakthrough Parsing Performance**: Infinity-Parser2-Pro substantially outperforms our previous 7B model, achieving 87.6% on olmOCR-Bench and 74.3% on ParseBench, surpassing frontier models such as DeepSeek-OCR-2, PaddleOCR-VL, and MinerU2.5.
|
| 57 |
+
- **Inference Acceleration**: Infinity-Parser2-Flash delivers significantly higher efficiency than Infinity-Parser-7B, with inference throughput increased by 3.68x (from 441 to 1,624 tokens/sec), reducing both deployment latency and costs.
|
| 58 |
+
|
| 59 |
+
## Performance
|
| 60 |
+
|
| 61 |
+
<p align="left">
|
| 62 |
+
<img src="https://raw.githubusercontent.com/infly-ai/INF-MLLM/main/Infinity-Parser2/assets/olmocr_bench_perf.png" width="1200"/>
|
| 63 |
+
<p>
|
| 64 |
+
|
| 65 |
+
<p align="left">
|
| 66 |
+
<img src="https://raw.githubusercontent.com/infly-ai/INF-MLLM/main/Infinity-Parser2/assets/parsebench_perf.png" width="1200"/>
|
| 67 |
+
<p>
|
| 68 |
+
|
| 69 |
+
<table align="center">
|
| 70 |
+
<thead>
|
| 71 |
+
<tr>
|
| 72 |
+
<th>Task</th>
|
| 73 |
+
<th>Infinity-Parser2-Pro</th>
|
| 74 |
+
<th>Infinity-Parser2-Flash</th>
|
| 75 |
+
<th>PaddleOCR-VL-1.5</th>
|
| 76 |
+
<th>DeepSeek-OCR-2</th>
|
| 77 |
+
<th>MinerU2.5</th>
|
| 78 |
+
<th>Gemini-3-Pro</th>
|
| 79 |
+
</tr>
|
| 80 |
+
</thead>
|
| 81 |
+
<tbody>
|
| 82 |
+
<tr>
|
| 83 |
+
<td colspan=7><b>Document Parsing</b></td>
|
| 84 |
+
</tr>
|
| 85 |
+
<tr>
|
| 86 |
+
<td>olmOCR-bench</td>
|
| 87 |
+
<td><b>87.6</b></td>
|
| 88 |
+
<td>86.0</td>
|
| 89 |
+
<td>78.5</td>
|
| 90 |
+
<td>76.3</td>
|
| 91 |
+
<td>75.2</td>
|
| 92 |
+
<td>-</td>
|
| 93 |
+
</tr>
|
| 94 |
+
<tr>
|
| 95 |
+
<td>ParseBench</td>
|
| 96 |
+
<td><b>74.3</b></td>
|
| 97 |
+
<td>72.2</td>
|
| 98 |
+
<td>66.0</td>
|
| 99 |
+
<td>41.2</td>
|
| 100 |
+
<td>45.9</td>
|
| 101 |
+
<td>69.1‡</td>
|
| 102 |
+
</tr>
|
| 103 |
+
<tr>
|
| 104 |
+
<td>OmniDocBench-v1.6</td>
|
| 105 |
+
<td>93.95</td>
|
| 106 |
+
<td>91.98</td>
|
| 107 |
+
<td><b>94.87</b></td>
|
| 108 |
+
<td>90.17</td>
|
| 109 |
+
<td>92.98</td>
|
| 110 |
+
<td>92.85</td>
|
| 111 |
+
</tr>
|
| 112 |
+
<tr>
|
| 113 |
+
<td colspan=7><b>Layout Analysis (mIoU)</b></td>
|
| 114 |
+
</tr>
|
| 115 |
+
<tr>
|
| 116 |
+
<td>DocLayNet</td>
|
| 117 |
+
<td>64.93*</td>
|
| 118 |
+
<td>64.97*</td>
|
| 119 |
+
<td><b>71.05*</b></td>
|
| 120 |
+
<td>45.62*</td>
|
| 121 |
+
<td>67.74*</td>
|
| 122 |
+
<td>-</td>
|
| 123 |
+
</tr>
|
| 124 |
+
<tr>
|
| 125 |
+
<td>D4LA</td>
|
| 126 |
+
<td><b>52.41*</b></td>
|
| 127 |
+
<td>46.05*</td>
|
| 128 |
+
<td>50.21*</td>
|
| 129 |
+
<td>33.03*</td>
|
| 130 |
+
<td>51.62*</td>
|
| 131 |
+
<td>-</td>
|
| 132 |
+
</tr>
|
| 133 |
+
<tr>
|
| 134 |
+
<td>OmniDocBench-v1.5-Layout</td>
|
| 135 |
+
<td>74.56*</td>
|
| 136 |
+
<td>73.07*</td>
|
| 137 |
+
<td>74.80*</td>
|
| 138 |
+
<td>55.28*</td>
|
| 139 |
+
<td><b>76.28*</b></td>
|
| 140 |
+
<td>-</td>
|
| 141 |
+
</tr>
|
| 142 |
+
<tr>
|
| 143 |
+
<td colspan=7><b>Element Parsing</b></td>
|
| 144 |
+
</tr>
|
| 145 |
+
<tr>
|
| 146 |
+
<td>OmniDocBench-v1.5-TextBlock</td>
|
| 147 |
+
<td><b>95.05</b></td>
|
| 148 |
+
<td>94.31</td>
|
| 149 |
+
<td>94.97*</td>
|
| 150 |
+
<td>84.13*</td>
|
| 151 |
+
<td>86.00</td>
|
| 152 |
+
<td>-</td>
|
| 153 |
+
</tr>
|
| 154 |
+
<tr>
|
| 155 |
+
<td>PubTabNet (val)</td>
|
| 156 |
+
<td><b>94.76</b></td>
|
| 157 |
+
<td>92.41</td>
|
| 158 |
+
<td>84.60</td>
|
| 159 |
+
<td>89.53*</td>
|
| 160 |
+
<td>89.07</td>
|
| 161 |
+
<td>91.40</td>
|
| 162 |
+
</tr>
|
| 163 |
+
<tr>
|
| 164 |
+
<td>UniMERNet</td>
|
| 165 |
+
<td><b>97.7</b></td>
|
| 166 |
+
<td>96.5</td>
|
| 167 |
+
<td>95.8*</td>
|
| 168 |
+
<td>79.8*</td>
|
| 169 |
+
<td>96.5</td>
|
| 170 |
+
<td>96.4</td>
|
| 171 |
+
</tr>
|
| 172 |
+
<tr>
|
| 173 |
+
<td colspan=7><b>Chart Parsing</b></td>
|
| 174 |
+
</tr>
|
| 175 |
+
<tr>
|
| 176 |
+
<td>Chart2Table</td>
|
| 177 |
+
<td><b>86.5</b></td>
|
| 178 |
+
<td>80.49</td>
|
| 179 |
+
<td>86.2*</td>
|
| 180 |
+
<td>49.7*</td>
|
| 181 |
+
<td>-</td>
|
| 182 |
+
<td>-</td>
|
| 183 |
+
</tr>
|
| 184 |
+
<tr>
|
| 185 |
+
<td>Chart2Json</td>
|
| 186 |
+
<td><b>73.69</b></td>
|
| 187 |
+
<td>67.66</td>
|
| 188 |
+
<td>-</td>
|
| 189 |
+
<td>-</td>
|
| 190 |
+
<td>-</td>
|
| 191 |
+
<td>-</td>
|
| 192 |
+
</tr>
|
| 193 |
+
<tr>
|
| 194 |
+
<td colspan=7><b>Chemical Formula Parsing</b></td>
|
| 195 |
+
</tr>
|
| 196 |
+
<tr>
|
| 197 |
+
<td>CoSyn_Chemical</td>
|
| 198 |
+
<td><b>73.19</b></td>
|
| 199 |
+
<td>63.34</td>
|
| 200 |
+
<td>-</td>
|
| 201 |
+
<td>47.02*</td>
|
| 202 |
+
<td>-</td>
|
| 203 |
+
<td>-</td>
|
| 204 |
+
</tr>
|
| 205 |
+
<tr>
|
| 206 |
+
<td colspan=7><b>Document VQA</b></td>
|
| 207 |
+
</tr>
|
| 208 |
+
<tr>
|
| 209 |
+
<td>DocVQA (val)</td>
|
| 210 |
+
<td><b>96.43</b></td>
|
| 211 |
+
<td>93.16</td>
|
| 212 |
+
<td>-</td>
|
| 213 |
+
<td>43.42*</td>
|
| 214 |
+
<td>-</td>
|
| 215 |
+
<td>93.68*</td>
|
| 216 |
+
</tr>
|
| 217 |
+
<tr>
|
| 218 |
+
<td>InfoVQA (val)</td>
|
| 219 |
+
<td><b>86.26</b></td>
|
| 220 |
+
<td>75.94</td>
|
| 221 |
+
<td>-</td>
|
| 222 |
+
<td>22.07*</td>
|
| 223 |
+
<td>-</td>
|
| 224 |
+
<td>85.24*</td>
|
| 225 |
+
</tr>
|
| 226 |
+
<tr>
|
| 227 |
+
<td colspan=7><b>General Multimodal Understanding</b></td>
|
| 228 |
+
</tr>
|
| 229 |
+
<tr>
|
| 230 |
+
<td>AI2D</td>
|
| 231 |
+
<td>88.89</td>
|
| 232 |
+
<td>79.53</td>
|
| 233 |
+
<td>-</td>
|
| 234 |
+
<td>37.66*</td>
|
| 235 |
+
<td>-</td>
|
| 236 |
+
<td><b>91.87*</b></td>
|
| 237 |
+
</tr>
|
| 238 |
+
<tr>
|
| 239 |
+
<td>MathVista (testmini)</td>
|
| 240 |
+
<td>71.4</td>
|
| 241 |
+
<td>59.5</td>
|
| 242 |
+
<td>-</td>
|
| 243 |
+
<td>-</td>
|
| 244 |
+
<td>-</td>
|
| 245 |
+
<td><b>81.8*</b></td>
|
| 246 |
+
</tr>
|
| 247 |
+
<tr>
|
| 248 |
+
<td>MMBench-EN (dev)</td>
|
| 249 |
+
<td>87.54</td>
|
| 250 |
+
<td>77.92</td>
|
| 251 |
+
<td>-</td>
|
| 252 |
+
<td>-</td>
|
| 253 |
+
<td>-</td>
|
| 254 |
+
<td><b>90.29*</b></td>
|
| 255 |
+
</tr>
|
| 256 |
+
<tr>
|
| 257 |
+
<td>MMBench-CN (dev)</td>
|
| 258 |
+
<td>86.43</td>
|
| 259 |
+
<td>75.77</td>
|
| 260 |
+
<td>-</td>
|
| 261 |
+
<td>-</td>
|
| 262 |
+
<td>-</td>
|
| 263 |
+
<td><b>90.98*</b></td>
|
| 264 |
+
</tr>
|
| 265 |
+
<tr>
|
| 266 |
+
<td>MMMU (val)</td>
|
| 267 |
+
<td><b>61.89</b></td>
|
| 268 |
+
<td>45.89</td>
|
| 269 |
+
<td>-</td>
|
| 270 |
+
<td>-</td>
|
| 271 |
+
<td>-</td>
|
| 272 |
+
<td>56.00*</td>
|
| 273 |
+
</tr>
|
| 274 |
+
<tr>
|
| 275 |
+
<td>MMStar</td>
|
| 276 |
+
<td>69.66</td>
|
| 277 |
+
<td>57.13</td>
|
| 278 |
+
<td>-</td>
|
| 279 |
+
<td>-</td>
|
| 280 |
+
<td>-</td>
|
| 281 |
+
<td><b>83.78*</b></td>
|
| 282 |
+
</tr>
|
| 283 |
+
<tr>
|
| 284 |
+
<td>OCRBench</td>
|
| 285 |
+
<td>86.20</td>
|
| 286 |
+
<td>81.60</td>
|
| 287 |
+
<td>-</td>
|
| 288 |
+
<td>47.20*</td>
|
| 289 |
+
<td>-</td>
|
| 290 |
+
<td><b>89.30*</b></td>
|
| 291 |
+
</tr>
|
| 292 |
+
</tbody>
|
| 293 |
+
</table>
|
| 294 |
+
|
| 295 |
+
Note: '*' denotes results evaluated using our internal evaluation tools. '‡' denotes results from the Gemini-3.1-Pro.
|
| 296 |
+
|
| 297 |
+
## Quick Start
|
| 298 |
+
|
| 299 |
+
### 1. Minimal "Hello World" (Native Transformers)
|
| 300 |
+
|
| 301 |
+
If you are looking for a minimal script to parse a single image to Markdown using the native `transformers` library, here is a simple snippet:
|
| 302 |
+
|
| 303 |
+
```python
|
| 304 |
+
from PIL import Image
|
| 305 |
+
import torch
|
| 306 |
+
from transformers import AutoModelForImageTextToText, AutoProcessor
|
| 307 |
+
from qwen_vl_utils import process_vision_info
|
| 308 |
+
|
| 309 |
+
# Load the model and processor
|
| 310 |
+
model = AutoModelForImageTextToText.from_pretrained(
|
| 311 |
+
"infly/Infinity-Parser2-Pro",
|
| 312 |
+
torch_dtype="float16",
|
| 313 |
+
device_map="auto",
|
| 314 |
+
)
|
| 315 |
+
processor = AutoProcessor.from_pretrained("infly/Infinity-Parser2-Pro")
|
| 316 |
+
|
| 317 |
+
# Build the messages for the model
|
| 318 |
+
pil_image = Image.open("demo_data/demo.png").convert("RGB")
|
| 319 |
+
min_pixels = 2048 # 32 * 64
|
| 320 |
+
max_pixels = 16777216 # 4096 * 4096
|
| 321 |
+
prompt = """
|
| 322 |
+
- Extract layout information from the provided PDF image.
|
| 323 |
+
- For each layout element, output its bbox, category, and the text content within the bbox.
|
| 324 |
+
- Bbox format: [x1, y1, x2, y2].
|
| 325 |
+
- Allowed layout categories: ['header', 'title', 'text', 'figure', 'table', 'formula', 'figure_caption', 'table_caption', 'formula_caption', 'figure_footnote', 'table_footnote', 'page_footnote', 'footer'].
|
| 326 |
+
- Text extraction and formatting:
|
| 327 |
+
1) For 'figure', the text field must be an empty string.
|
| 328 |
+
2) For 'formula', format text as LaTeX.
|
| 329 |
+
3) For 'table', format text as HTML.
|
| 330 |
+
4) For all other categories (e.g., text, title), format text as Markdown.
|
| 331 |
+
- The output text must be exactly the original text from the image, with no translation or rewriting.
|
| 332 |
+
- Sort all layout elements in human reading order.
|
| 333 |
+
- Final output must be a single JSON object.
|
| 334 |
+
"""
|
| 335 |
+
|
| 336 |
+
messages = [
|
| 337 |
+
{
|
| 338 |
+
"role": "user",
|
| 339 |
+
"content": [
|
| 340 |
+
{
|
| 341 |
+
"type": "image",
|
| 342 |
+
"image": pil_image,
|
| 343 |
+
"min_pixels": min_pixels,
|
| 344 |
+
"max_pixels": max_pixels,
|
| 345 |
+
},
|
| 346 |
+
{"type": "text", "text": prompt},
|
| 347 |
+
],
|
| 348 |
+
}
|
| 349 |
+
]
|
| 350 |
+
|
| 351 |
+
chat_template_kwargs = {"enable_thinking": False}
|
| 352 |
+
|
| 353 |
+
text = processor.apply_chat_template(
|
| 354 |
+
messages, tokenize=False, add_generation_prompt=True, **chat_template_kwargs
|
| 355 |
+
)
|
| 356 |
+
image_inputs, _ = process_vision_info(messages, image_patch_size=16)
|
| 357 |
+
|
| 358 |
+
inputs = processor(
|
| 359 |
+
text=text,
|
| 360 |
+
images=image_inputs,
|
| 361 |
+
do_resize=False,
|
| 362 |
+
padding=True,
|
| 363 |
+
return_tensors="pt",
|
| 364 |
+
)
|
| 365 |
+
|
| 366 |
+
# Move all tensors to the same device as the model
|
| 367 |
+
inputs = {
|
| 368 |
+
k: v.to(model.device) if isinstance(v, torch.Tensor) else v
|
| 369 |
+
for k, v in inputs.items()
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
# Generate the response
|
| 373 |
+
generated_ids = model.generate(
|
| 374 |
+
**inputs,
|
| 375 |
+
max_new_tokens=32768,
|
| 376 |
+
temperature=0.0,
|
| 377 |
+
top_p=1.0,
|
| 378 |
+
)
|
| 379 |
+
|
| 380 |
+
# Strip input tokens, keeping only the newly generated response
|
| 381 |
+
generated_ids_trimmed = [
|
| 382 |
+
out_ids[len(in_ids) :]
|
| 383 |
+
for in_ids, out_ids in zip(inputs["input_ids"], generated_ids)
|
| 384 |
+
]
|
| 385 |
+
output_text = processor.batch_decode(
|
| 386 |
+
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
| 387 |
+
)
|
| 388 |
+
print(output_text)
|
| 389 |
+
```
|
| 390 |
+
|
| 391 |
+
### 2. Advanced Pipeline (infinity_parser2)
|
| 392 |
+
|
| 393 |
+
For bulk processing, advanced features, or an end-to-end PDF parsing pipeline, we recommend using our infinity_parser2 wrapper.
|
| 394 |
+
|
| 395 |
+
#### Pre-requisites
|
| 396 |
+
|
| 397 |
+
```bash
|
| 398 |
+
# Create a Conda environment (Optional)
|
| 399 |
+
conda create -n infinity_parser2 python=3.12
|
| 400 |
+
conda activate infinity_parser2
|
| 401 |
+
|
| 402 |
+
# Install PyTorch (CUDA). Find the proper version at https://pytorch.org/get-started/previous-versions based on your CUDA version.
|
| 403 |
+
pip install torch==2.10.0 torchvision==0.25.0 torchaudio==2.10.0 --index-url https://download.pytorch.org/whl/cu128
|
| 404 |
+
|
| 405 |
+
# Install FlashAttention (FlashAttention-2 is recommended by default)
|
| 406 |
+
# Standard install (compiles from source, ~10-30 min):
|
| 407 |
+
pip install flash-attn==2.8.3 --no-build-isolation
|
| 408 |
+
# Faster install: download wheel from https://github.com/Dao-AILab/flash-attention/releases. Then run: pip install /path/to/<wheel_filename>.whl
|
| 409 |
+
# For Hopper GPUs (e.g. H100, H800), we recommend FlashAttention-3 instead. See: https://github.com/Dao-AILab/flash-attention
|
| 410 |
+
# NOTE: The code will prioritize detecting FlashAttention-3. If not found, it falls back to FlashAttention-2.
|
| 411 |
+
|
| 412 |
+
# Install vLLM
|
| 413 |
+
# NOTE: you may need to run the command below to resolve triton and numpy conflicts before installing vllm.
|
| 414 |
+
# pip uninstall -y pytorch-triton opencv-python opencv-python-headless numpy && rm -rf "$(python -c 'import site; print(site.getsitepackages()[0])')/cv2"
|
| 415 |
+
pip install vllm==0.17.1
|
| 416 |
+
```
|
| 417 |
+
|
| 418 |
+
#### Install infinity_parser2
|
| 419 |
+
|
| 420 |
+
Install from PyPI
|
| 421 |
+
|
| 422 |
+
```bash
|
| 423 |
+
pip install infinity_parser2
|
| 424 |
+
```
|
| 425 |
+
|
| 426 |
+
Install from source code
|
| 427 |
+
|
| 428 |
+
```bash
|
| 429 |
+
git clone https://github.com/infly-ai/INF-MLLM.git
|
| 430 |
+
cd INF-MLLM/Infinity-Parser2
|
| 431 |
+
pip install -e .
|
| 432 |
+
```
|
| 433 |
+
|
| 434 |
+
#### Usage
|
| 435 |
+
|
| 436 |
+
##### Command Line
|
| 437 |
+
|
| 438 |
+
The `parser` command is the fastest way to get started.
|
| 439 |
+
|
| 440 |
+
```bash
|
| 441 |
+
# NOTE: The Infinity-Parser2 model will be automatically downloaded on the first run.
|
| 442 |
+
|
| 443 |
+
# Parse a PDF (outputs Markdown by default)
|
| 444 |
+
parser demo_data/demo.pdf
|
| 445 |
+
|
| 446 |
+
# Parse an image
|
| 447 |
+
parser demo_data/demo.png
|
| 448 |
+
|
| 449 |
+
# Batch parse multiple files
|
| 450 |
+
parser demo_data/demo.pdf demo_data/demo.png -o ./output
|
| 451 |
+
|
| 452 |
+
# Parse an entire directory
|
| 453 |
+
parser demo_data -o ./output
|
| 454 |
+
|
| 455 |
+
# Output raw JSON with layout bboxes
|
| 456 |
+
parser demo_data/demo.pdf --output-format json
|
| 457 |
+
|
| 458 |
+
# Convert to Markdown directly
|
| 459 |
+
parser demo_data/demo.png --task doc2md
|
| 460 |
+
```
|
| 461 |
+
|
| 462 |
+
```bash
|
| 463 |
+
# View all options
|
| 464 |
+
parser --help
|
| 465 |
+
```
|
| 466 |
+
|
| 467 |
+
##### Python API
|
| 468 |
+
|
| 469 |
+
```python
|
| 470 |
+
# NOTE: The Infinity-Parser2 model will be automatically downloaded on the first run.
|
| 471 |
+
|
| 472 |
+
from infinity_parser2 import InfinityParser2
|
| 473 |
+
|
| 474 |
+
parser = InfinityParser2()
|
| 475 |
+
|
| 476 |
+
# Parse a single file (returns Markdown)
|
| 477 |
+
result = parser.parse("demo_data/demo.pdf")
|
| 478 |
+
print(result)
|
| 479 |
+
|
| 480 |
+
# Parse multiple files (returns list)
|
| 481 |
+
results = parser.parse(["demo_data/demo.pdf", "demo_data/demo.png"])
|
| 482 |
+
|
| 483 |
+
# Parse a directory (returns dict)
|
| 484 |
+
results = parser.parse("demo_data")
|
| 485 |
+
```
|
| 486 |
+
|
| 487 |
+
**Output formats:**
|
| 488 |
+
|
| 489 |
+
| task_type | Description | Default Output |
|
| 490 |
+
|-------------|------------------------------------------------------|----------------|
|
| 491 |
+
| `doc2json` | Extract layout elements with bboxes (default) | Markdown |
|
| 492 |
+
| `doc2md` | Directly convert to Markdown | Markdown |
|
| 493 |
+
| `custom` | Use your own prompt | Raw model output |
|
| 494 |
+
|
| 495 |
+
```python
|
| 496 |
+
# doc2json: get raw JSON with bbox coordinates
|
| 497 |
+
result = parser.parse("demo_data/demo.pdf", output_format="json")
|
| 498 |
+
|
| 499 |
+
# doc2md: direct Markdown conversion
|
| 500 |
+
result = parser.parse("demo_data/demo.pdf", task_type="doc2md")
|
| 501 |
+
|
| 502 |
+
# Custom prompt
|
| 503 |
+
result = parser.parse("demo_data/demo.pdf", task_type="custom",
|
| 504 |
+
custom_prompt="Please transform the document's contents into Markdown format.")
|
| 505 |
+
|
| 506 |
+
# Batch processing with custom batch size
|
| 507 |
+
result = parser.parse("demo_data", batch_size=8)
|
| 508 |
+
|
| 509 |
+
# Save results to directory
|
| 510 |
+
parser.parse("demo_data/demo.pdf", output_dir="./output")
|
| 511 |
+
```
|
| 512 |
+
|
| 513 |
+
**Backends:**
|
| 514 |
+
|
| 515 |
+
Infinity-Parser2 supports three inference backends. By default it uses the **vLLM Engine** (offline batch inference).
|
| 516 |
+
|
| 517 |
+
```python
|
| 518 |
+
# vLLM Engine (default) — offline batch inference
|
| 519 |
+
parser = InfinityParser2(
|
| 520 |
+
model_name="infly/Infinity-Parser2-Pro",
|
| 521 |
+
backend="vllm-engine", # default
|
| 522 |
+
tensor_parallel_size=2,
|
| 523 |
+
)
|
| 524 |
+
|
| 525 |
+
# Transformers — local single-GPU inference
|
| 526 |
+
parser = InfinityParser2(
|
| 527 |
+
model_name="infly/Infinity-Parser2-Pro",
|
| 528 |
+
backend="transformers",
|
| 529 |
+
device="cuda",
|
| 530 |
+
torch_dtype="bfloat16", # "float16" or "bfloat16"
|
| 531 |
+
)
|
| 532 |
+
|
| 533 |
+
# vLLM Server — online HTTP API (start server first)
|
| 534 |
+
parser = InfinityParser2(
|
| 535 |
+
model_name="infly/Infinity-Parser2-Pro",
|
| 536 |
+
backend="vllm-server",
|
| 537 |
+
api_url="http://localhost:8000/v1/chat/completions",
|
| 538 |
+
api_key="EMPTY",
|
| 539 |
+
)
|
| 540 |
+
```
|
| 541 |
+
|
| 542 |
+
To start a vLLM server:
|
| 543 |
+
|
| 544 |
+
```bash
|
| 545 |
+
vllm serve infly/Infinity-Parser2-Pro \
|
| 546 |
+
--trust-remote-code \
|
| 547 |
+
--reasoning-parser qwen3 \
|
| 548 |
+
--host 0.0.0.0 \
|
| 549 |
+
--port 8000 \
|
| 550 |
+
--tensor-parallel-size 2 \
|
| 551 |
+
--gpu-memory-utilization 0.85 \
|
| 552 |
+
--max-model-len 65536 \
|
| 553 |
+
--mm-encoder-tp-mode data \
|
| 554 |
+
--mm-processor-cache-type shm \
|
| 555 |
+
--enable-prefix-caching
|
| 556 |
+
```
|
| 557 |
+
|
| 558 |
+
For more details, please refer to the [official guide](https://github.com/infly-ai/INF-MLLM/blob/main/Infinity-Parser2).
|
| 559 |
+
|
| 560 |
+
### Visual Parsing Examples
|
| 561 |
+
|
| 562 |
+
| Visualization | Note |
|
| 563 |
+
| --- | --- |
|
| 564 |
+
| [A-Stock](https://raw.githubusercontent.com/infly-ai/INF-MLLM/main/Infinity-Parser2/assets/a_stock.png) | Easy to miscount colspan in tables |
|
| 565 |
+
| [Multi-Column Layout](https://raw.githubusercontent.com/infly-ai/INF-MLLM/main/Infinity-Parser2/assets/muti_column.png) | Complex layout analysis and reading order recovery. |
|
| 566 |
+
| [Historical Newspaper](https://raw.githubusercontent.com/infly-ai/INF-MLLM/main/Infinity-Parser2/assets/newspaper_2.png) | High probability of bounding box omission caused by ultra-dense text distribution, narrow column margins, and microscopic fonts. |
|
| 567 |
+
| [US-Stock](https://raw.githubusercontent.com/infly-ai/INF-MLLM/main/Infinity-Parser2/assets/us_stock.png) | Precise row alignment across wide frameless spaces and capturing the hierarchical semantics of indented headers. |
|
| 568 |
+
| [Academic Paper (arXiv)](https://raw.githubusercontent.com/infly-ai/INF-MLLM/main/Infinity-Parser2/assets/arxiv.png) | Accurate structural preservation of complex multi-line mathematical formulas, dense inline notations, and deeply nested subscripts/superscripts. |
|
| 569 |
+
| [Magazine Page](https://raw.githubusercontent.com/infly-ai/INF-MLLM/main/Infinity-Parser2/assets/magazine.png) | Complex reading order recovery in an asymmetric multi-column layout. |
|
| 570 |
+
| [Scanned Mathematics](https://raw.githubusercontent.com/infly-ai/INF-MLLM/main/Infinity-Parser2/assets/old_scan_math.png) | Degraded and blurred print |
|
| 571 |
+
|
| 572 |
+
## Limitations
|
| 573 |
+
|
| 574 |
+
Infinity-Parser2 has several known limitations to consider. It primarily supports English and Chinese documents, and performance degrades when processing multilingual content. Accuracy may also be reduced when parsing charts with complex layouts, as well as documents containing multi-oriented elements such as table rotated at varying angles. Additionally, the model does not capture fine-grained text formatting (e.g., bold, italic, strikethrough) and exhibits suboptimal multimodal instruction-following capability, meaning it may not always reliably follow complex multi-step visual instructions.
|
| 575 |
+
|
| 576 |
+
## Acknowledgments
|
| 577 |
+
|
| 578 |
+
We would like to thank [Qwen3.5](https://github.com/QwenLM/Qwen3.5), [ms-swift](https://github.com/modelscope/ms-swift), [VeRL](https://github.com/verl-project/verl), [lmms-eval](https://github.com/EvolvingLMMs-Lab/lmms-eval), [olmocr](https://huggingface.co/datasets/allenai/olmOCR-bench), [PaddleOCR-VL](https://github.com/PaddlePaddle/PaddleOCR), [MinerU](https://github.com/opendatalab/MinerU), [dots.ocr](https://github.com/rednote-hilab/dots.ocr), [Chandra-OCR-2](https://github.com/datalab-to/chandra) for providing dataset, code and models.
|
| 579 |
+
|
| 580 |
+
## Citation
|
| 581 |
+
|
| 582 |
+
```
|
| 583 |
+
@misc{huang2026infinityparser2technicalreport,
|
| 584 |
+
title={Infinity-Parser2 Technical Report},
|
| 585 |
+
author={Zuming Huang and Jun Huang and Kexuan Ren and Baode Wang and Weizhen Li and Jianming Feng and Yu Wang and Yichen Yao and Shijun Lin and Yige Tang and Cheng Peng and Weidi Xu and Wei Chu and Yinghui Xu and Yuan Qi},
|
| 586 |
+
year={2026},
|
| 587 |
+
eprint={2607.07836},
|
| 588 |
+
archivePrefix={arXiv},
|
| 589 |
+
primaryClass={cs.AI},
|
| 590 |
+
url={https://arxiv.org/abs/2607.07836},
|
| 591 |
+
}
|
| 592 |
+
```
|
| 593 |
+
|
| 594 |
+
# License
|
| 595 |
+
|
| 596 |
+
This model is licensed under apache-2.0.
|
assets/logo.png
ADDED
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- set image_count = namespace(value=0) %}
|
| 2 |
+
{%- set video_count = namespace(value=0) %}
|
| 3 |
+
{%- macro render_content(content, do_vision_count, is_system_content=false) %}
|
| 4 |
+
{%- if content is string %}
|
| 5 |
+
{{- content }}
|
| 6 |
+
{%- elif content is iterable and content is not mapping %}
|
| 7 |
+
{%- for item in content %}
|
| 8 |
+
{%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
|
| 9 |
+
{%- if is_system_content %}
|
| 10 |
+
{{- raise_exception('System message cannot contain images.') }}
|
| 11 |
+
{%- endif %}
|
| 12 |
+
{%- if do_vision_count %}
|
| 13 |
+
{%- set image_count.value = image_count.value + 1 %}
|
| 14 |
+
{%- endif %}
|
| 15 |
+
{%- if add_vision_id %}
|
| 16 |
+
{{- 'Picture ' ~ image_count.value ~ ': ' }}
|
| 17 |
+
{%- endif %}
|
| 18 |
+
{{- '<|vision_start|><|image_pad|><|vision_end|>' }}
|
| 19 |
+
{%- elif 'video' in item or item.type == 'video' %}
|
| 20 |
+
{%- if is_system_content %}
|
| 21 |
+
{{- raise_exception('System message cannot contain videos.') }}
|
| 22 |
+
{%- endif %}
|
| 23 |
+
{%- if do_vision_count %}
|
| 24 |
+
{%- set video_count.value = video_count.value + 1 %}
|
| 25 |
+
{%- endif %}
|
| 26 |
+
{%- if add_vision_id %}
|
| 27 |
+
{{- 'Video ' ~ video_count.value ~ ': ' }}
|
| 28 |
+
{%- endif %}
|
| 29 |
+
{{- '<|vision_start|><|video_pad|><|vision_end|>' }}
|
| 30 |
+
{%- elif 'text' in item %}
|
| 31 |
+
{{- item.text }}
|
| 32 |
+
{%- else %}
|
| 33 |
+
{{- raise_exception('Unexpected item type in content.') }}
|
| 34 |
+
{%- endif %}
|
| 35 |
+
{%- endfor %}
|
| 36 |
+
{%- elif content is none or content is undefined %}
|
| 37 |
+
{{- '' }}
|
| 38 |
+
{%- else %}
|
| 39 |
+
{{- raise_exception('Unexpected content type.') }}
|
| 40 |
+
{%- endif %}
|
| 41 |
+
{%- endmacro %}
|
| 42 |
+
{%- if not messages %}
|
| 43 |
+
{{- raise_exception('No messages provided.') }}
|
| 44 |
+
{%- endif %}
|
| 45 |
+
{%- if tools and tools is iterable and tools is not mapping %}
|
| 46 |
+
{{- '<|im_start|>system\n' }}
|
| 47 |
+
{{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
|
| 48 |
+
{%- for tool in tools %}
|
| 49 |
+
{{- "\n" }}
|
| 50 |
+
{{- tool | tojson }}
|
| 51 |
+
{%- endfor %}
|
| 52 |
+
{{- "\n</tools>" }}
|
| 53 |
+
{{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
|
| 54 |
+
{%- if messages[0].role == 'system' %}
|
| 55 |
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
| 56 |
+
{%- if content %}
|
| 57 |
+
{{- '\n\n' + content }}
|
| 58 |
+
{%- endif %}
|
| 59 |
+
{%- endif %}
|
| 60 |
+
{{- '<|im_end|>\n' }}
|
| 61 |
+
{%- else %}
|
| 62 |
+
{%- if messages[0].role == 'system' %}
|
| 63 |
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
| 64 |
+
{{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
|
| 65 |
+
{%- endif %}
|
| 66 |
+
{%- endif %}
|
| 67 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 68 |
+
{%- for message in messages[::-1] %}
|
| 69 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 70 |
+
{%- if ns.multi_step_tool and message.role == "user" %}
|
| 71 |
+
{%- set content = render_content(message.content, false)|trim %}
|
| 72 |
+
{%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
|
| 73 |
+
{%- set ns.multi_step_tool = false %}
|
| 74 |
+
{%- set ns.last_query_index = index %}
|
| 75 |
+
{%- endif %}
|
| 76 |
+
{%- endif %}
|
| 77 |
+
{%- endfor %}
|
| 78 |
+
{%- if ns.multi_step_tool %}
|
| 79 |
+
{{- raise_exception('No user query found in messages.') }}
|
| 80 |
+
{%- endif %}
|
| 81 |
+
{%- for message in messages %}
|
| 82 |
+
{%- set content = render_content(message.content, true)|trim %}
|
| 83 |
+
{%- if message.role == "system" %}
|
| 84 |
+
{%- if not loop.first %}
|
| 85 |
+
{{- raise_exception('System message must be at the beginning.') }}
|
| 86 |
+
{%- endif %}
|
| 87 |
+
{%- elif message.role == "user" %}
|
| 88 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 89 |
+
{%- elif message.role == "assistant" %}
|
| 90 |
+
{%- set reasoning_content = '' %}
|
| 91 |
+
{%- if message.reasoning_content is string %}
|
| 92 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 93 |
+
{%- else %}
|
| 94 |
+
{%- if '</think>' in content %}
|
| 95 |
+
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 96 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 97 |
+
{%- endif %}
|
| 98 |
+
{%- endif %}
|
| 99 |
+
{%- set reasoning_content = reasoning_content|trim %}
|
| 100 |
+
{%- if loop.index0 > ns.last_query_index %}
|
| 101 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
|
| 102 |
+
{%- else %}
|
| 103 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 104 |
+
{%- endif %}
|
| 105 |
+
{%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
|
| 106 |
+
{%- for tool_call in message.tool_calls %}
|
| 107 |
+
{%- if tool_call.function is defined %}
|
| 108 |
+
{%- set tool_call = tool_call.function %}
|
| 109 |
+
{%- endif %}
|
| 110 |
+
{%- if loop.first %}
|
| 111 |
+
{%- if content|trim %}
|
| 112 |
+
{{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 113 |
+
{%- else %}
|
| 114 |
+
{{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 115 |
+
{%- endif %}
|
| 116 |
+
{%- else %}
|
| 117 |
+
{{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 118 |
+
{%- endif %}
|
| 119 |
+
{%- if tool_call.arguments is defined %}
|
| 120 |
+
{%- for args_name, args_value in tool_call.arguments|items %}
|
| 121 |
+
{{- '<parameter=' + args_name + '>\n' }}
|
| 122 |
+
{%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
|
| 123 |
+
{{- args_value }}
|
| 124 |
+
{{- '\n</parameter>\n' }}
|
| 125 |
+
{%- endfor %}
|
| 126 |
+
{%- endif %}
|
| 127 |
+
{{- '</function>\n</tool_call>' }}
|
| 128 |
+
{%- endfor %}
|
| 129 |
+
{%- endif %}
|
| 130 |
+
{{- '<|im_end|>\n' }}
|
| 131 |
+
{%- elif message.role == "tool" %}
|
| 132 |
+
{%- if loop.previtem and loop.previtem.role != "tool" %}
|
| 133 |
+
{{- '<|im_start|>user' }}
|
| 134 |
+
{%- endif %}
|
| 135 |
+
{{- '\n<tool_response>\n' }}
|
| 136 |
+
{{- content }}
|
| 137 |
+
{{- '\n</tool_response>' }}
|
| 138 |
+
{%- if not loop.last and loop.nextitem.role != "tool" %}
|
| 139 |
+
{{- '<|im_end|>\n' }}
|
| 140 |
+
{%- elif loop.last %}
|
| 141 |
+
{{- '<|im_end|>\n' }}
|
| 142 |
+
{%- endif %}
|
| 143 |
+
{%- else %}
|
| 144 |
+
{{- raise_exception('Unexpected message role.') }}
|
| 145 |
+
{%- endif %}
|
| 146 |
+
{%- endfor %}
|
| 147 |
+
{%- if add_generation_prompt %}
|
| 148 |
+
{{- '<|im_start|>assistant\n' }}
|
| 149 |
+
{%- if enable_thinking is defined and enable_thinking is true %}
|
| 150 |
+
{{- '<think>\n' }}
|
| 151 |
+
{%- else %}
|
| 152 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 153 |
+
{%- endif %}
|
| 154 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3_5ForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"bos_token_id": null,
|
| 6 |
+
"dtype": "bfloat16",
|
| 7 |
+
"eos_token_id": 248046,
|
| 8 |
+
"hidden_size": 2048,
|
| 9 |
+
"image_token_id": 248056,
|
| 10 |
+
"model_type": "qwen3_5",
|
| 11 |
+
"pad_token_id": 248044,
|
| 12 |
+
"rope_theta": 10000000,
|
| 13 |
+
"text_config": {
|
| 14 |
+
"attention_bias": false,
|
| 15 |
+
"attention_dropout": 0.0,
|
| 16 |
+
"attn_output_gate": true,
|
| 17 |
+
"bos_token_id": null,
|
| 18 |
+
"dtype": "bfloat16",
|
| 19 |
+
"eos_token_id": 248044,
|
| 20 |
+
"full_attention_interval": 4,
|
| 21 |
+
"head_dim": 256,
|
| 22 |
+
"hidden_act": "silu",
|
| 23 |
+
"hidden_size": 2048,
|
| 24 |
+
"initializer_range": 0.02,
|
| 25 |
+
"intermediate_size": 6144,
|
| 26 |
+
"layer_types": [
|
| 27 |
+
"linear_attention",
|
| 28 |
+
"linear_attention",
|
| 29 |
+
"linear_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"linear_attention",
|
| 32 |
+
"linear_attention",
|
| 33 |
+
"linear_attention",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"linear_attention",
|
| 36 |
+
"linear_attention",
|
| 37 |
+
"linear_attention",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"linear_attention",
|
| 40 |
+
"linear_attention",
|
| 41 |
+
"linear_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"linear_attention",
|
| 44 |
+
"linear_attention",
|
| 45 |
+
"linear_attention",
|
| 46 |
+
"full_attention",
|
| 47 |
+
"linear_attention",
|
| 48 |
+
"linear_attention",
|
| 49 |
+
"linear_attention",
|
| 50 |
+
"full_attention"
|
| 51 |
+
],
|
| 52 |
+
"linear_conv_kernel_dim": 4,
|
| 53 |
+
"linear_key_head_dim": 128,
|
| 54 |
+
"linear_num_key_heads": 16,
|
| 55 |
+
"linear_num_value_heads": 16,
|
| 56 |
+
"linear_value_head_dim": 128,
|
| 57 |
+
"mamba_ssm_dtype": "float32",
|
| 58 |
+
"max_position_embeddings": 262144,
|
| 59 |
+
"mlp_only_layers": [],
|
| 60 |
+
"model_type": "qwen3_5_text",
|
| 61 |
+
"mtp_num_hidden_layers": 1,
|
| 62 |
+
"mtp_use_dedicated_embeddings": false,
|
| 63 |
+
"num_attention_heads": 8,
|
| 64 |
+
"num_hidden_layers": 24,
|
| 65 |
+
"num_key_value_heads": 2,
|
| 66 |
+
"pad_token_id": null,
|
| 67 |
+
"partial_rotary_factor": 0.25,
|
| 68 |
+
"rms_norm_eps": 1e-06,
|
| 69 |
+
"rope_parameters": {
|
| 70 |
+
"mrope_interleaved": true,
|
| 71 |
+
"mrope_section": [
|
| 72 |
+
11,
|
| 73 |
+
11,
|
| 74 |
+
10
|
| 75 |
+
],
|
| 76 |
+
"partial_rotary_factor": 0.25,
|
| 77 |
+
"rope_theta": 10000000,
|
| 78 |
+
"rope_type": "default"
|
| 79 |
+
},
|
| 80 |
+
"tie_word_embeddings": true,
|
| 81 |
+
"use_cache": true,
|
| 82 |
+
"vocab_size": 248320
|
| 83 |
+
},
|
| 84 |
+
"tie_word_embeddings": true,
|
| 85 |
+
"transformers_version": "5.3.0",
|
| 86 |
+
"video_token_id": 248057,
|
| 87 |
+
"vision_config": {
|
| 88 |
+
"deepstack_visual_indexes": [],
|
| 89 |
+
"depth": 24,
|
| 90 |
+
"dtype": "bfloat16",
|
| 91 |
+
"hidden_act": "gelu_pytorch_tanh",
|
| 92 |
+
"hidden_size": 1024,
|
| 93 |
+
"in_channels": 3,
|
| 94 |
+
"initializer_range": 0.02,
|
| 95 |
+
"intermediate_size": 4096,
|
| 96 |
+
"model_type": "qwen3_5",
|
| 97 |
+
"num_heads": 16,
|
| 98 |
+
"num_position_embeddings": 2304,
|
| 99 |
+
"out_hidden_size": 2048,
|
| 100 |
+
"patch_size": 16,
|
| 101 |
+
"spatial_merge_size": 2,
|
| 102 |
+
"temporal_patch_size": 2
|
| 103 |
+
},
|
| 104 |
+
"vision_end_token_id": 248054,
|
| 105 |
+
"vision_start_token_id": 248053
|
| 106 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:761cb9295e05047bc8628effd7381023458f193955b804098dd332c464f26150
|
| 3 |
+
size 4426558832
|
processor_config.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"image_processor": {
|
| 3 |
+
"data_format": "channels_first",
|
| 4 |
+
"do_convert_rgb": true,
|
| 5 |
+
"do_normalize": true,
|
| 6 |
+
"do_rescale": true,
|
| 7 |
+
"do_resize": true,
|
| 8 |
+
"image_mean": [
|
| 9 |
+
0.5,
|
| 10 |
+
0.5,
|
| 11 |
+
0.5
|
| 12 |
+
],
|
| 13 |
+
"image_processor_type": "Qwen2VLImageProcessorFast",
|
| 14 |
+
"image_std": [
|
| 15 |
+
0.5,
|
| 16 |
+
0.5,
|
| 17 |
+
0.5
|
| 18 |
+
],
|
| 19 |
+
"merge_size": 2,
|
| 20 |
+
"patch_size": 16,
|
| 21 |
+
"resample": 3,
|
| 22 |
+
"rescale_factor": 0.00392156862745098,
|
| 23 |
+
"size": {
|
| 24 |
+
"longest_edge": 16777216,
|
| 25 |
+
"shortest_edge": 65536
|
| 26 |
+
},
|
| 27 |
+
"temporal_patch_size": 2
|
| 28 |
+
},
|
| 29 |
+
"processor_class": "Qwen3VLProcessor",
|
| 30 |
+
"video_processor": {
|
| 31 |
+
"data_format": "channels_first",
|
| 32 |
+
"default_to_square": true,
|
| 33 |
+
"do_convert_rgb": true,
|
| 34 |
+
"do_normalize": true,
|
| 35 |
+
"do_rescale": true,
|
| 36 |
+
"do_resize": true,
|
| 37 |
+
"do_sample_frames": true,
|
| 38 |
+
"fps": 2,
|
| 39 |
+
"image_mean": [
|
| 40 |
+
0.5,
|
| 41 |
+
0.5,
|
| 42 |
+
0.5
|
| 43 |
+
],
|
| 44 |
+
"image_std": [
|
| 45 |
+
0.5,
|
| 46 |
+
0.5,
|
| 47 |
+
0.5
|
| 48 |
+
],
|
| 49 |
+
"max_frames": 768,
|
| 50 |
+
"merge_size": 2,
|
| 51 |
+
"min_frames": 4,
|
| 52 |
+
"patch_size": 16,
|
| 53 |
+
"resample": 3,
|
| 54 |
+
"rescale_factor": 0.00392156862745098,
|
| 55 |
+
"return_metadata": false,
|
| 56 |
+
"size": {
|
| 57 |
+
"longest_edge": 25165824,
|
| 58 |
+
"shortest_edge": 4096
|
| 59 |
+
},
|
| 60 |
+
"temporal_patch_size": 2,
|
| 61 |
+
"video_processor_type": "Qwen3VLVideoProcessor"
|
| 62 |
+
}
|
| 63 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:87a7830d63fcf43bf241c3c5242e96e62dd3fdc29224ca26fed8ea333db72de4
|
| 3 |
+
size 19989343
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"audio_bos_token": "<|audio_start|>",
|
| 4 |
+
"audio_eos_token": "<|audio_end|>",
|
| 5 |
+
"audio_token": "<|audio_pad|>",
|
| 6 |
+
"backend": "tokenizers",
|
| 7 |
+
"bos_token": null,
|
| 8 |
+
"clean_up_tokenization_spaces": false,
|
| 9 |
+
"eos_token": "<|im_end|>",
|
| 10 |
+
"errors": "replace",
|
| 11 |
+
"image_token": "<|image_pad|>",
|
| 12 |
+
"is_local": true,
|
| 13 |
+
"model_max_length": 262144,
|
| 14 |
+
"model_specific_special_tokens": {
|
| 15 |
+
"audio_bos_token": "<|audio_start|>",
|
| 16 |
+
"audio_eos_token": "<|audio_end|>",
|
| 17 |
+
"audio_token": "<|audio_pad|>",
|
| 18 |
+
"image_token": "<|image_pad|>",
|
| 19 |
+
"video_token": "<|video_pad|>",
|
| 20 |
+
"vision_bos_token": "<|vision_start|>",
|
| 21 |
+
"vision_eos_token": "<|vision_end|>"
|
| 22 |
+
},
|
| 23 |
+
"pad_token": "<|endoftext|>",
|
| 24 |
+
"pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
|
| 25 |
+
"processor_class": "Qwen3VLProcessor",
|
| 26 |
+
"split_special_tokens": false,
|
| 27 |
+
"tokenizer_class": "TokenizersBackend",
|
| 28 |
+
"unk_token": null,
|
| 29 |
+
"video_token": "<|video_pad|>",
|
| 30 |
+
"vision_bos_token": "<|vision_start|>",
|
| 31 |
+
"vision_eos_token": "<|vision_end|>"
|
| 32 |
+
}
|