Image-Text-to-Text
Transformers
Safetensors
English
Chinese
multilingual
qwen3_5
ocr
pdf
document-parsing
document-understanding
layout-analysis
table-recognition
chart-parsing
formula-recognition
chemical-formula
markdown
vision-language
infinity-parser
infinity_parser2
conversational
Eval Results
Instructions to use infly/Infinity-Parser2-Flash with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use infly/Infinity-Parser2-Flash with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="infly/Infinity-Parser2-Flash") 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, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("infly/Infinity-Parser2-Flash") model = AutoModelForImageTextToText.from_pretrained("infly/Infinity-Parser2-Flash") 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 infly/Infinity-Parser2-Flash with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "infly/Infinity-Parser2-Flash" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "infly/Infinity-Parser2-Flash", "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/infly/Infinity-Parser2-Flash
- SGLang
How to use infly/Infinity-Parser2-Flash 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 "infly/Infinity-Parser2-Flash" \ --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": "infly/Infinity-Parser2-Flash", "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 "infly/Infinity-Parser2-Flash" \ --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": "infly/Infinity-Parser2-Flash", "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 infly/Infinity-Parser2-Flash with Docker Model Runner:
docker model run hf.co/infly/Infinity-Parser2-Flash
Update README.md
Browse files
README.md
CHANGED
|
@@ -80,7 +80,7 @@ We are excited to release Infinity-Parser2, our latest flagship document underst
|
|
| 80 |
<td>92.85</td>
|
| 81 |
</tr>
|
| 82 |
<tr>
|
| 83 |
-
<td colspan=7>Layout Analysis (mIoU)</td>
|
| 84 |
</tr>
|
| 85 |
<tr>
|
| 86 |
<td>DocLayNet</td>
|
|
@@ -110,7 +110,7 @@ We are excited to release Infinity-Parser2, our latest flagship document underst
|
|
| 110 |
<td>-</td>
|
| 111 |
</tr>
|
| 112 |
<tr>
|
| 113 |
-
<td colspan=7>Element Parsing</td>
|
| 114 |
</tr>
|
| 115 |
<tr>
|
| 116 |
<td>OmniDocBench-v1.5-TextBlock</td>
|
|
@@ -140,7 +140,7 @@ We are excited to release Infinity-Parser2, our latest flagship document underst
|
|
| 140 |
<td>96.4</td>
|
| 141 |
</tr>
|
| 142 |
<tr>
|
| 143 |
-
<td colspan=7>Chart Parsing</td>
|
| 144 |
</tr>
|
| 145 |
<tr>
|
| 146 |
<td>Chart2Table</td>
|
|
@@ -161,7 +161,7 @@ We are excited to release Infinity-Parser2, our latest flagship document underst
|
|
| 161 |
<td>-</td>
|
| 162 |
</tr>
|
| 163 |
<tr>
|
| 164 |
-
<td colspan=7>Chemical Formula Parsing</td>
|
| 165 |
</tr>
|
| 166 |
<tr>
|
| 167 |
<td>CoSyn_Chemical</td>
|
|
@@ -173,7 +173,7 @@ We are excited to release Infinity-Parser2, our latest flagship document underst
|
|
| 173 |
<td>-</td>
|
| 174 |
</tr>
|
| 175 |
<tr>
|
| 176 |
-
<td colspan=7>Document VQA</td>
|
| 177 |
</tr>
|
| 178 |
<tr>
|
| 179 |
<td>DocVQA (val)</td>
|
|
@@ -194,7 +194,7 @@ We are excited to release Infinity-Parser2, our latest flagship document underst
|
|
| 194 |
<td>85.24*</td>
|
| 195 |
</tr>
|
| 196 |
<tr>
|
| 197 |
-
<td colspan=7>General Multimodal Understanding</td>
|
| 198 |
</tr>
|
| 199 |
<tr>
|
| 200 |
<td>AI2D</td>
|
|
|
|
| 80 |
<td>92.85</td>
|
| 81 |
</tr>
|
| 82 |
<tr>
|
| 83 |
+
<td colspan=7><b>Layout Analysis (mIoU)</b></td>
|
| 84 |
</tr>
|
| 85 |
<tr>
|
| 86 |
<td>DocLayNet</td>
|
|
|
|
| 110 |
<td>-</td>
|
| 111 |
</tr>
|
| 112 |
<tr>
|
| 113 |
+
<td colspan=7><b>Element Parsing</b></td>
|
| 114 |
</tr>
|
| 115 |
<tr>
|
| 116 |
<td>OmniDocBench-v1.5-TextBlock</td>
|
|
|
|
| 140 |
<td>96.4</td>
|
| 141 |
</tr>
|
| 142 |
<tr>
|
| 143 |
+
<td colspan=7><b>Chart Parsing</b></td>
|
| 144 |
</tr>
|
| 145 |
<tr>
|
| 146 |
<td>Chart2Table</td>
|
|
|
|
| 161 |
<td>-</td>
|
| 162 |
</tr>
|
| 163 |
<tr>
|
| 164 |
+
<td colspan=7><b>Chemical Formula Parsing</b></td>
|
| 165 |
</tr>
|
| 166 |
<tr>
|
| 167 |
<td>CoSyn_Chemical</td>
|
|
|
|
| 173 |
<td>-</td>
|
| 174 |
</tr>
|
| 175 |
<tr>
|
| 176 |
+
<td colspan=7><b>Document VQA</b></td>
|
| 177 |
</tr>
|
| 178 |
<tr>
|
| 179 |
<td>DocVQA (val)</td>
|
|
|
|
| 194 |
<td>85.24*</td>
|
| 195 |
</tr>
|
| 196 |
<tr>
|
| 197 |
+
<td colspan=7><b>General Multimodal Understanding</b></td>
|
| 198 |
</tr>
|
| 199 |
<tr>
|
| 200 |
<td>AI2D</td>
|