Instructions to use zenosai/MonkeyOCRv2-S with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zenosai/MonkeyOCRv2-S with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-feature-extraction", model="zenosai/MonkeyOCRv2-S", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("zenosai/MonkeyOCRv2-S", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -255,29 +255,49 @@ pip install modelscope
|
|
| 255 |
python download_model.py -t modelscope -n MonkeyOCRv2-B-Parsing # or MonkeyOCRv2-S-Parsing
|
| 256 |
```
|
| 257 |
|
| 258 |
-
#### 3.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
Parse a single document or a directory containing PDFs or images:
|
| 260 |
```bash
|
| 261 |
cd parsing
|
| 262 |
python parse.py \
|
| 263 |
-
-i ../images_test
|
| 264 |
-o output/test \
|
| 265 |
-
-
|
| 266 |
-
-g 500 \
|
| 267 |
--draw-layout \
|
| 268 |
--skip-processed
|
| 269 |
# Show help messages
|
| 270 |
python parse.py -h
|
| 271 |
```
|
| 272 |
|
| 273 |
-
#### 4. Web Demo
|
| 274 |
-
Start gradio web demo:
|
| 275 |
```bash
|
| 276 |
cd parsing
|
| 277 |
-
python demo/gradio_demo.py
|
| 278 |
-
|
| 279 |
-
|
| 280 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
|
| 282 |
### Document Understanding
|
| 283 |
#### 1. Install
|
|
@@ -997,12 +1017,12 @@ Our model supports robust document parsing in real-world scenarios across 17 lan
|
|
| 997 |
<tr>
|
| 998 |
<td>dots.mocr</td><td>3B</td><td>1.2B</td><td>1.8B</td><td>80.5</td><td><strong>90.5</strong></td><td>77.2</td><td>81.7</td><td>82.6</td><td><strong>87.4</strong></td><td>71.3</td><td>70.1</td><td>84.5</td><td><strong>89.3</strong></td><td>83.2</td><td>86.8</td><td>79.9</td><td>79.2</td><td>83.3</td><td>83.6</td><td><strong>75.0</strong></td><td>78.7</td><td>71.2</td><td>77.9</td><td><u>84.6</u></td><td><strong>79.6</strong></td>
|
| 999 |
</tr>
|
| 1000 |
-
|
| 1001 |
-
|
| 1002 |
-
|
| 1003 |
-
|
| 1004 |
-
|
| 1005 |
-
|
| 1006 |
</tbody>
|
| 1007 |
</table>
|
| 1008 |
|
|
@@ -1191,16 +1211,4 @@ This multi-expert agreement strategy reduces model-specific annotation errors an
|
|
| 1191 |
- **Qwen3**: https://github.com/QwenLM/Qwen3
|
| 1192 |
|
| 1193 |
## Copyright
|
| 1194 |
-
We warmly welcome your feedback, suggestions, and contributions, which are essential to the continued development and improvement of our framework. Note: This model is intended for academic research and non-commercial use only. For any questions, please contact us at xbai@hust.edu.cn or ylliu@hust.edu.cn.
|
| 1195 |
-
|
| 1196 |
-
## Citation
|
| 1197 |
-
If you find **MonkeyOCRv2** useful, consider citing our work:
|
| 1198 |
-
|
| 1199 |
-
```bibtex
|
| 1200 |
-
@article{liu2026monkeyocrv2,
|
| 1201 |
-
title={MonkeyOCRv2: A Visual-Text Foundation Model for Document AI},
|
| 1202 |
-
author={Yuliang Liu and Zhang Li and Ziyang Zhang and Shuo Zhang and Qiang Liu and Jiajun Song and Zidun Guo and Xinhan Wang and Handong Zheng and Yang Liu and Dongliang Luo and Zhiyin Ma and Jiarui Zhang and Xiang Bai},
|
| 1203 |
-
journal={arXiv preprint arXiv:2607.11562},
|
| 1204 |
-
year={2026}
|
| 1205 |
-
}
|
| 1206 |
-
```
|
|
|
|
| 255 |
python download_model.py -t modelscope -n MonkeyOCRv2-B-Parsing # or MonkeyOCRv2-S-Parsing
|
| 256 |
```
|
| 257 |
|
| 258 |
+
#### 3. vLLM Serving
|
| 259 |
+
You should start a vLLM service before parsing documents:
|
| 260 |
+
```bash
|
| 261 |
+
cd parsing
|
| 262 |
+
python serve.py -m ../model_weight/MonkeyOCRv2-B-Parsing -p 8888
|
| 263 |
+
# Show help messages
|
| 264 |
+
python serve.py -h
|
| 265 |
+
```
|
| 266 |
+
|
| 267 |
+
#### 4. Inference
|
| 268 |
+
You can parse documents using CLI or serve with demo and FastAPI.
|
| 269 |
+
|
| 270 |
+
##### 4.1 Parse using CLI
|
| 271 |
Parse a single document or a directory containing PDFs or images:
|
| 272 |
```bash
|
| 273 |
cd parsing
|
| 274 |
python parse.py \
|
| 275 |
+
-i ../images_test \
|
| 276 |
-o output/test \
|
| 277 |
+
-s http://127.0.0.1:8888 \
|
|
|
|
| 278 |
--draw-layout \
|
| 279 |
--skip-processed
|
| 280 |
# Show help messages
|
| 281 |
python parse.py -h
|
| 282 |
```
|
| 283 |
|
| 284 |
+
##### 4.2 Serve with Web Demo
|
|
|
|
| 285 |
```bash
|
| 286 |
cd parsing
|
| 287 |
+
python demo/gradio_demo.py -s http://127.0.0.1:8888 -p 8891
|
| 288 |
+
# Show help messages
|
| 289 |
+
python demo/gradio_demo.py -h
|
| 290 |
```
|
| 291 |
+
You can access the web demo at http://localhost:8891.
|
| 292 |
+
|
| 293 |
+
##### 4.3 Serve with FastAPI
|
| 294 |
+
```bash
|
| 295 |
+
cd parsing
|
| 296 |
+
python fastapi/main.py -s http://127.0.0.1:8888 -p 8000
|
| 297 |
+
# Show help messages
|
| 298 |
+
python fastapi/main.py -h
|
| 299 |
+
```
|
| 300 |
+
You can access the API documentation at http://localhost:8000/docs to explore available endpoints.
|
| 301 |
|
| 302 |
### Document Understanding
|
| 303 |
#### 1. Install
|
|
|
|
| 1017 |
<tr>
|
| 1018 |
<td>dots.mocr</td><td>3B</td><td>1.2B</td><td>1.8B</td><td>80.5</td><td><strong>90.5</strong></td><td>77.2</td><td>81.7</td><td>82.6</td><td><strong>87.4</strong></td><td>71.3</td><td>70.1</td><td>84.5</td><td><strong>89.3</strong></td><td>83.2</td><td>86.8</td><td>79.9</td><td>79.2</td><td>83.3</td><td>83.6</td><td><strong>75.0</strong></td><td>78.7</td><td>71.2</td><td>77.9</td><td><u>84.6</u></td><td><strong>79.6</strong></td>
|
| 1019 |
</tr>
|
| 1020 |
+
<tr>
|
| 1021 |
+
<td><strong>MonkeyOCRv2-S-Parsing<a href="https://huggingface.co/zenosai/MonkeyOCRv2-S-Parsing">🤗</a></strong></td><td>0.6B</td><td>0.03B</td><td>0.6B</td><td><u>82.5</u></td><td>87.9</td><td><u>80.7</u></td><td><u>83.2</u></td><td><u>87.3</u></td><td>83.6</td><td><strong>76.8</strong></td><td>73.6</td><td><u>85.4</u></td><td>87.2</td><td><u>85.5</u></td><td>87.4</td><td>81.9</td><td><u>81.7</u></td><td><strong>91.2</strong></td><td><u>87.1</u></td><td>69.9</td><td><strong>88.7</strong></td><td><u>78.0</u></td><td><u>79.8</u></td><td>84.4</td><td>74.7</td>
|
| 1022 |
+
</tr>
|
| 1023 |
+
<tr>
|
| 1024 |
+
<td><strong>MonkeyOCRv2-B-Parsing<a href="https://huggingface.co/zenosai/MonkeyOCRv2-B-Parsing">🤗</a><strong></td><td>0.7B</td><td>0.1B</td><td>0.6B</td><td><strong>83.3</strong></td><td><u>88.1</u></td><td><strong>81.7</strong></td><td><strong>84.2</strong></td><td><strong>87.7</strong></td><td>84.5</td><td>75.2</td><td><strong>78.4</strong></td><td><strong>86.5</strong></td><td><u>88.6</u></td><td><strong>86.1</strong></td><td>87.9</td><td>83.2</td><td><strong>82.1</strong></td><td><u>90.7</u></td><td><strong>87.2</strong></td><td>71.9</td><td><u>87.6</u></td><td><strong>80.1</strong></td><td><strong>80.8</strong></td><td>83.6</td><td>75.3</td>
|
| 1025 |
+
</tr>
|
| 1026 |
</tbody>
|
| 1027 |
</table>
|
| 1028 |
|
|
|
|
| 1211 |
- **Qwen3**: https://github.com/QwenLM/Qwen3
|
| 1212 |
|
| 1213 |
## Copyright
|
| 1214 |
+
We warmly welcome your feedback, suggestions, and contributions, which are essential to the continued development and improvement of our framework. Note: This model is intended for academic research and non-commercial use only. For any questions, please contact us at xbai@hust.edu.cn or ylliu@hust.edu.cn.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|