zuminghuang commited on
Commit
43a9a56
·
verified ·
1 Parent(s): e13e7a8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +162 -10
README.md CHANGED
@@ -11,35 +11,187 @@
11
  🚀 <a>Demo (coming soon...)</a>
12
  </p>
13
 
14
- # News
15
 
16
- - [2026-04-11] We release Infinity-Parser2-Pro, our flagship document parsing model — now available as a preview. Stay tuned: the official release, the lightweight Infinity-Parser2-Flash, and our multimodal parsing dataset Infinity-Doc2-10M are coming soon.
 
17
 
18
- # Introduction
19
 
20
  We are excited to release Infinity-Parser2-Pro, our latest flagship document understanding model that achieves a new state-of-the-art on olmOCR-Bench with a score of 86.7%, surpassing frontier models such as DeepSeek-OCR-2, PaddleOCR-VL, and dots.mocr. Building on our previous model Infinity-Parser-7B, we have significantly enhanced our data engine and multi-task reinforcement learning approach. This enables the model to consolidate robust multi-modal parsing capabilities into a unified architecture, delivering brand-new zero-shot capabilities for diverse real-world business scenarios.
21
 
22
- ## Key Features
23
 
24
  - **Upgraded Data Engine**: We have comprehensively enhanced our synthetic data engine to support both fixed-layout and flexible-layout document formats. By generating over 1 million diverse full-text samples covering a wide range of document layouts, combined with a dynamic adaptive sampling strategy, we ensure highly balanced and robust multi-task learning across various document types.
25
  - **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 doc2json and doc2markdown.
26
  - **Breakthrough Parsing Performance**: It substantially outperforms our previous 7B model, achieving 86.7% on olmOCR-Bench, surpassing frontier models such as DeepSeek-OCR-2, PaddleOCR-VL, and dots.mocr.
27
  - **Inference Acceleration**: By adopting the highly efficient MoE architecture, our inference throughput has increased by 21% (from 441 to 534 tokens/sec), reducing deployment latency and costs.
28
 
29
- # Performance
30
 
31
  <p align="left">
32
  <img src="assets/document_parsing_performance_evaluation.png" width="1200"/>
33
  <p>
34
 
35
- # Quick Start
36
 
37
- Coming soon...
38
 
39
- # Citation
40
 
41
- Coming soon...
 
 
42
 
43
- # License
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
  This model is licensed under apache-2.0.
 
11
  🚀 <a>Demo (coming soon...)</a>
12
  </p>
13
 
14
+ ## News
15
 
16
+ - [2026-04-14] We uploaded the quick start guide for Infinity-Parser2. Feel free to contact us if you have any questions.
17
+ - [2026-04-11] We released Infinity-Parser2-Pro, our flagship document parsing model — now available as a preview. Stay tuned: the official release, the lightweight Infinity-Parser2-Flash, and our multimodal parsing dataset Infinity-Doc2-10M are coming soon.
18
 
19
+ ## Introduction
20
 
21
  We are excited to release Infinity-Parser2-Pro, our latest flagship document understanding model that achieves a new state-of-the-art on olmOCR-Bench with a score of 86.7%, surpassing frontier models such as DeepSeek-OCR-2, PaddleOCR-VL, and dots.mocr. Building on our previous model Infinity-Parser-7B, we have significantly enhanced our data engine and multi-task reinforcement learning approach. This enables the model to consolidate robust multi-modal parsing capabilities into a unified architecture, delivering brand-new zero-shot capabilities for diverse real-world business scenarios.
22
 
23
+ ### Key Features
24
 
25
  - **Upgraded Data Engine**: We have comprehensively enhanced our synthetic data engine to support both fixed-layout and flexible-layout document formats. By generating over 1 million diverse full-text samples covering a wide range of document layouts, combined with a dynamic adaptive sampling strategy, we ensure highly balanced and robust multi-task learning across various document types.
26
  - **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 doc2json and doc2markdown.
27
  - **Breakthrough Parsing Performance**: It substantially outperforms our previous 7B model, achieving 86.7% on olmOCR-Bench, surpassing frontier models such as DeepSeek-OCR-2, PaddleOCR-VL, and dots.mocr.
28
  - **Inference Acceleration**: By adopting the highly efficient MoE architecture, our inference throughput has increased by 21% (from 441 to 534 tokens/sec), reducing deployment latency and costs.
29
 
30
+ ## Performance
31
 
32
  <p align="left">
33
  <img src="assets/document_parsing_performance_evaluation.png" width="1200"/>
34
  <p>
35
 
36
+ ## Quick Start
37
 
38
+ ### Installation
39
 
40
+ #### Pre-requisites
41
 
42
+ ```bash
43
+ # Install PyTorch (CUDA). Find the proper version on the [official site](https://pytorch.org/get-started/previous-versions) based on your CUDA version.
44
+ pip install torch==2.10.0 torchvision==0.25.0 torchaudio==2.10.0 --index-url https://download.pytorch.org/whl/cu128
45
 
46
+ # Install FlashAttention (required for NVIDIA GPUs).
47
+ # This command builds flash-attn from source, which can take 10 to 30 minutes.
48
+ pip install flash-attn==2.8.3 --no-build-isolation
49
+ # For Hopper GPUs (e.g. H100, H800), we recommend FlashAttention-3 instead. See the [official guide](https://github.com/Dao-AILab/flash-attention).
50
+
51
+ # Install vLLM
52
+ # NOTE: you may need to run the command below to resolve triton and numpy conflicts before installing vllm.
53
+ # pip uninstall -y pytorch-triton opencv-python opencv-python-headless numpy && rm -rf "$(python -c 'import site; print(site.getsitepackages()[0])')/cv2"
54
+ pip install vllm==0.17.1
55
+ ```
56
+
57
+ #### Install infinity_parser2
58
+
59
+ ```bash
60
+ # From PyPI
61
+ pip install infinity_parser2
62
+
63
+ # From source
64
+ git clone https://github.com/infly-ai/INF-MLLM.git
65
+ cd INF-MLLM/Infinity-Parser2
66
+ pip install -e .
67
+ ```
68
+
69
+ ### Usage
70
+
71
+ #### Command Line
72
+
73
+ The `parser` command is the fastest way to get started.
74
+
75
+ ```bash
76
+ # Parse a PDF (outputs Markdown by default)
77
+ parser demo_data/demo.pdf
78
+
79
+ # Parse an image
80
+ parser demo_data/demo.png
81
+
82
+ # Batch parse multiple files
83
+ parser demo_data/demo.pdf demo_data/demo.png -o ./output
84
+
85
+ # Parse an entire directory
86
+ parser demo_data -o ./output
87
+
88
+ # Output raw JSON with layout bboxes
89
+ parser demo_data/demo.pdf --output-format json
90
+
91
+ # Convert to Markdown directly
92
+ parser demo_data/demo.png --task doc2md
93
+ ```
94
+
95
+ ```bash
96
+ # View all options
97
+ parser --help
98
+ ```
99
+
100
+ #### Python API
101
+
102
+ ```python
103
+ from infinity_parser2 import InfinityParser2
104
+
105
+ parser = InfinityParser2()
106
+
107
+ # Parse a single file (returns Markdown)
108
+ result = parser.parse("demo_data/demo.pdf")
109
+ print(result)
110
+
111
+ # Parse multiple files (returns list)
112
+ results = parser.parse(["demo_data/demo.pdf", "demo_data/demo.png"])
113
+
114
+ # Parse a directory (returns dict)
115
+ results = parser.parse("demo_data")
116
+ ```
117
+
118
+ **Output formats:**
119
+
120
+ | task_type | Description | Default Output |
121
+ |-------------|------------------------------------------------------|----------------|
122
+ | `doc2json` | Extract layout elements with bboxes (default) | Markdown |
123
+ | `doc2md` | Directly convert to Markdown | Markdown |
124
+ | `custom` | Use your own prompt | Raw model output |
125
+
126
+ ```python
127
+ # doc2json: get raw JSON with bbox coordinates
128
+ result = parser.parse("demo_data/demo.pdf", output_format="json")
129
+
130
+ # doc2md: direct Markdown conversion
131
+ result = parser.parse("demo_data/demo.pdf", task_type="doc2md")
132
+
133
+ # Custom prompt
134
+ result = parser.parse("demo_data/demo.pdf", task_type="custom",
135
+ custom_prompt="Extract the title and authors only.")
136
+
137
+ # Batch processing with custom batch size
138
+ result = parser.parse("demo_data", batch_size=8)
139
+
140
+ # Save results to directory
141
+ parser.parse("demo_data/demo.pdf", output_dir="./output")
142
+ ```
143
+
144
+ **Backends:**
145
+
146
+ Infinity-Parser2 supports three inference backends. By default it uses the **vLLM Engine** (offline batch inference).
147
+
148
+ ```python
149
+ # vLLM Engine (default) — offline batch inference
150
+ parser = InfinityParser2(
151
+ model_name="infly/Infinity-Parser2-Pro",
152
+ backend="vllm-engine", # default
153
+ tensor_parallel_size=2,
154
+ )
155
+
156
+ # Transformers — local single-GPU inference
157
+ parser = InfinityParser2(
158
+ model_name="infly/Infinity-Parser2-Pro",
159
+ backend="transformers",
160
+ device="cuda",
161
+ torch_dtype="bfloat16", # "float16" or "bfloat16"
162
+ )
163
+
164
+ # vLLM Server — online HTTP API (start server first)
165
+ parser = InfinityParser2(
166
+ model_name="infly/Infinity-Parser2-Pro",
167
+ backend="vllm-server",
168
+ api_url="http://localhost:8000/v1/chat/completions",
169
+ api_key="EMPTY",
170
+ )
171
+ ```
172
+
173
+ To start a vLLM server:
174
+
175
+ ```bash
176
+ vllm serve infly/Infinity-Parser2-Pro \
177
+ --trust-remote-code \
178
+ --reasoning-parser qwen3 \
179
+ --host 0.0.0.0 \
180
+ --port 8000 \
181
+ --tensor-parallel-size 2 \
182
+ --gpu-memory-utilization 0.85 \
183
+ --max-model-len 65536 \
184
+ --mm-encoder-tp-mode data \
185
+ --mm-processor-cache-type shm \
186
+ --enable-prefix-caching
187
+ ```
188
+
189
+ For model details, please refer to [offical guide](https://github.com/infly-ai/INF-MLLM/blob/main/Infinity-Parser2).
190
+
191
+ ## Acknowledgments
192
+
193
+ 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.
194
+
195
+ ## License
196
 
197
  This model is licensed under apache-2.0.