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", 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?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("infly/Infinity-Parser2-Flash") model = AutoModelForMultimodalLM.from_pretrained("infly/Infinity-Parser2-Flash", 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 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
|
@@ -13,8 +13,34 @@
|
|
| 13 |
|
| 14 |
# Introduction
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# Architecture
|
| 20 |
|
|
|
|
| 13 |
|
| 14 |
# Introduction
|
| 15 |
|
| 16 |
+
We are delighted to release Infinity-Parser2-2B, our latest state-of-the-art document understanding model. Compared to our prior model, Infinity-Parser-7B, we have deeply optimized our data engine and multi-task reinforcement learning. We have successfully condensed robust multi-modal parsing capabilities into a highly efficient 2B-parameter model, offering massive speedups and brand-new zero-shot capabilities for real-world business scenarios.
|
| 17 |
+
|
| 18 |
+
## 🌟 Key Features
|
| 19 |
+
|
| 20 |
+
### 📚 Upgraded Data Engine
|
| 21 |
+
- **Massive & Diverse Data:** Added **1M+ full-text samples** across 9 document types (academic, financial, books, etc.).
|
| 22 |
+
- **Targeted Enrichment:** Injected 170K synthetic financial tables, 900K formulas, and 5K negative samples to mitigate hallucinations.
|
| 23 |
+
- **Adaptive Sampling:** Dynamically adjusts data distribution based on task importance and dataset size for balanced learning.
|
| 24 |
+
|
| 25 |
+
### 🧠 Multi-Task Reinforcement Learning
|
| 26 |
+
- **Verifiable Reward System:** Designed a novel reward mechanism to support Joint Reinforcement Learning (RL).
|
| 27 |
+
- **Unified Optimization:** Simultaneously co-optimizes multiple tasks, ranging from full-text and table parsing to layout analysis and Document VQA.
|
| 28 |
+
|
| 29 |
+
### 📈 Breakthrough Parsing Performance
|
| 30 |
+
Despite its compact 2B size, it significantly outperforms our previous 7B model:
|
| 31 |
+
- **Domain SOTA:** Achieves SOTA on financial benchmarks (`FinDocBench`, `FinTabBench`), surpassing frontier models like DeepSeek-OCR2, GLM-OCR, and PaddleOCR-VL-v1.5.
|
| 32 |
+
- **Public Benchmarks:** Achieves SOTA on `olmOCR-Bench` and `PubTabNet`, with highly competitive results on `OmniDocBench-v1.5` and `UniMERNet`.
|
| 33 |
+
- **General Multimodal:** Scores **66.06** on average across 7 benchmarks (e.g., MathVista, MMMU), beating the Qwen3-VL-2B base (+3.2pt).
|
| 34 |
+
|
| 35 |
+
### 🚀 Massive Inference Acceleration (3.68x Faster)
|
| 36 |
+
- **Optimized Architecture:** Transitioned to the highly efficient **Qwen3-VL-2B** base model.
|
| 37 |
+
- **Blazing Fast:** Inference throughput surged by **3.68x** (from 441 to **1,624 tokens/sec**), slashing latency and deployment costs without accuracy drop.
|
| 38 |
+
|
| 39 |
+
### ✨ Expanded Capabilities (Zero-to-One Additions)
|
| 40 |
+
Unlocked entirely new skills in this release:
|
| 41 |
+
- **Chart Parsing:** Scores 79.91 on `Chart2Table`.
|
| 42 |
+
- **Chemical Structures:** Scores 68.05 on our new `ChemDraw-198` and 52.78 on `CoSyn-Chemical`.
|
| 43 |
+
- **Layout Analysis:** Achieves 64.92 on `DocLayNet` and 73.16 on `OmniDocBench-v1.5-layout`, matching dedicated layout models like DocLayout-YOLO.
|
| 44 |
|
| 45 |
# Architecture
|
| 46 |
|