Image-Text-to-Text
Transformers
Safetensors
monkeyocrv2
text-generation
conversational
custom_code
Eval Results
Instructions to use zenosai/MonkeyOCRv2-B-Parsing with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zenosai/MonkeyOCRv2-B-Parsing with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="zenosai/MonkeyOCRv2-B-Parsing", trust_remote_code=True) 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 AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("zenosai/MonkeyOCRv2-B-Parsing", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use zenosai/MonkeyOCRv2-B-Parsing with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zenosai/MonkeyOCRv2-B-Parsing" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zenosai/MonkeyOCRv2-B-Parsing", "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/zenosai/MonkeyOCRv2-B-Parsing
- SGLang
How to use zenosai/MonkeyOCRv2-B-Parsing 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 "zenosai/MonkeyOCRv2-B-Parsing" \ --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": "zenosai/MonkeyOCRv2-B-Parsing", "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 "zenosai/MonkeyOCRv2-B-Parsing" \ --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": "zenosai/MonkeyOCRv2-B-Parsing", "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 zenosai/MonkeyOCRv2-B-Parsing with Docker Model Runner:
docker model run hf.co/zenosai/MonkeyOCRv2-B-Parsing
Update README.md
Browse files
README.md
CHANGED
|
@@ -21,9 +21,9 @@ library_name: transformers
|
|
| 21 |
</div>
|
| 22 |
|
| 23 |
## News
|
|
|
|
| 24 |
* `2026.07.22` π MonkeyOCRv2-B-Parsing ranks #1 among evaluated open-source models on the official [MDPBench Leaderboard](https://huggingface.co/spaces/Delores-Lin/MDPBench-leaderboard), achieving 83.3 overall across 17 languages, including digital-born and photographed documents.
|
| 25 |
* `2026.07.21` π¦ We release [MonkeyDoc v2](https://modelscope.cn/datasets/zenosai/MonkeyDocv2), an open multilingual corpus for document-oriented pretraining. We hope it can serve as a shared data foundation for more transparent, reproducible, and fair comparisons in Document AI.
|
| 26 |
-
* `2026.07.20` π€ MonkeyOCRv2 was featured in [Hugging Face Daily Papers](https://huggingface.co/papers/2607.11562) and has entered the Weekly Papers list. Thanks to the community for the support, upvotes, and feedback!
|
| 27 |
* `2026.07.14` π We release [MonkeyOCRv2](https://arxiv.org/abs/2607.11562), including MonkeyOCRv2 vision encoder, MonkeyOCRv2-Parsing for multilingual document parsing, MonkeyOCRv2-Und for efficient document understanding.
|
| 28 |
|
| 29 |
## Use MonkeyOCRv2 as a Vision Backbone
|
|
@@ -264,27 +264,44 @@ Install vLLM following its [official guide](https://docs.vllm.ai/en/v0.11.2/gett
|
|
| 264 |
conda create -n MonkeyOCRv2Parsing python=3.10
|
| 265 |
conda activate MonkeyOCRv2Parsing
|
| 266 |
pip install uv
|
| 267 |
-
uv pip install vllm
|
| 268 |
pip install -r parsing/requirements.txt
|
| 269 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
|
| 271 |
#### 2. Download Model Weights
|
| 272 |
Download our model from Huggingface.
|
| 273 |
```bash
|
| 274 |
python download_model.py -n MonkeyOCRv2-B-Parsing # or MonkeyOCRv2-S-Parsing
|
|
|
|
|
|
|
| 275 |
```
|
| 276 |
You can also download our model from ModelScope.
|
| 277 |
|
| 278 |
```bash
|
| 279 |
pip install modelscope
|
| 280 |
python download_model.py -t modelscope -n MonkeyOCRv2-B-Parsing # or MonkeyOCRv2-S-Parsing
|
|
|
|
|
|
|
| 281 |
```
|
| 282 |
|
| 283 |
#### 3. vLLM Serving
|
| 284 |
You should start a vLLM service before parsing documents:
|
| 285 |
```bash
|
| 286 |
cd parsing
|
| 287 |
-
|
|
|
|
|
|
|
|
|
|
| 288 |
# Show help messages
|
| 289 |
python serve.py -h
|
| 290 |
```
|
|
@@ -1242,6 +1259,9 @@ This multi-expert agreement strategy reduces model-specific annotation errors an
|
|
| 1242 |
- **MonkeyDoc**: https://modelscope.cn/datasets/zenosai/MonkeyDoc
|
| 1243 |
- **MonkeyDoc v2**: https://modelscope.cn/datasets/zenosai/MonkeyDocv2
|
| 1244 |
|
|
|
|
|
|
|
|
|
|
| 1245 |
## Citation
|
| 1246 |
If you use any part of this release β the MonkeyOCRv2 encoders, MonkeyOCRv2-Parsing,
|
| 1247 |
MonkeyOCRv2-Und, the MDPBench benchmark, or the MonkeyDoc v2 dataset β please cite:
|
|
@@ -1259,4 +1279,4 @@ MonkeyOCRv2-Und, the MDPBench benchmark, or the MonkeyDoc v2 dataset β please
|
|
| 1259 |
```
|
| 1260 |
|
| 1261 |
## Copyright
|
| 1262 |
-
We warmly welcome your feedback, suggestions, and contributions, which are essential to the continued development and improvement of our framework. The models are are released under the [Apache License 2.0](LICENSE) and are free for both research and commercial use. For any questions, please contact us at xbai@hust.edu.cn or ylliu@hust.edu.cn.
|
|
|
|
| 21 |
</div>
|
| 22 |
|
| 23 |
## News
|
| 24 |
+
* `2026.07.24` β‘ We released [MonkeyOCRv2-B-Parsing-DFlash](https://huggingface.co/zenosai/MonkeyOCRv2-B-Parsing-DFlash), enabling vLLM serving with DFlash for up to 2Γ faster inference.
|
| 25 |
* `2026.07.22` π MonkeyOCRv2-B-Parsing ranks #1 among evaluated open-source models on the official [MDPBench Leaderboard](https://huggingface.co/spaces/Delores-Lin/MDPBench-leaderboard), achieving 83.3 overall across 17 languages, including digital-born and photographed documents.
|
| 26 |
* `2026.07.21` π¦ We release [MonkeyDoc v2](https://modelscope.cn/datasets/zenosai/MonkeyDocv2), an open multilingual corpus for document-oriented pretraining. We hope it can serve as a shared data foundation for more transparent, reproducible, and fair comparisons in Document AI.
|
|
|
|
| 27 |
* `2026.07.14` π We release [MonkeyOCRv2](https://arxiv.org/abs/2607.11562), including MonkeyOCRv2 vision encoder, MonkeyOCRv2-Parsing for multilingual document parsing, MonkeyOCRv2-Und for efficient document understanding.
|
| 28 |
|
| 29 |
## Use MonkeyOCRv2 as a Vision Backbone
|
|
|
|
| 264 |
conda create -n MonkeyOCRv2Parsing python=3.10
|
| 265 |
conda activate MonkeyOCRv2Parsing
|
| 266 |
pip install uv
|
| 267 |
+
uv pip install vllm --extra-index-url https://wheels.vllm.ai/0.25.1/cu129 --extra-index-url https://download.pytorch.org/whl/cu129 -i https://pypi.tuna.tsinghua.edu.cn/simple
|
| 268 |
pip install -r parsing/requirements.txt
|
| 269 |
```
|
| 270 |
+
To use DFlash for faster inference, **vLLM 0.25.1** is required, which depends on **CUDA 12.9 or later**.
|
| 271 |
+
|
| 272 |
+
If your system does not support CUDA 12.9, you can instead install **vLLM 0.11.2** (without DFlash support) by running:
|
| 273 |
+
|
| 274 |
+
```bash
|
| 275 |
+
uv pip install vllm==0.11.2 --torch-backend=auto -i https://pypi.tuna.tsinghua.edu.cn/simple requests
|
| 276 |
+
```
|
| 277 |
+
|
| 278 |
+
Inference will still work normally, but DFlash acceleration will not be available.
|
| 279 |
+
|
| 280 |
|
| 281 |
#### 2. Download Model Weights
|
| 282 |
Download our model from Huggingface.
|
| 283 |
```bash
|
| 284 |
python download_model.py -n MonkeyOCRv2-B-Parsing # or MonkeyOCRv2-S-Parsing
|
| 285 |
+
# use DFlash for faster inference, support MonkeyOCRv2-B-Parsing only for now
|
| 286 |
+
python download_model.py -n MonkeyOCRv2-B-Parsing-DFlash
|
| 287 |
```
|
| 288 |
You can also download our model from ModelScope.
|
| 289 |
|
| 290 |
```bash
|
| 291 |
pip install modelscope
|
| 292 |
python download_model.py -t modelscope -n MonkeyOCRv2-B-Parsing # or MonkeyOCRv2-S-Parsing
|
| 293 |
+
# use DFlash for faster inference, support MonkeyOCRv2-B-Parsing only for now
|
| 294 |
+
python download_model.py -n MonkeyOCRv2-B-Parsing-DFlash
|
| 295 |
```
|
| 296 |
|
| 297 |
#### 3. vLLM Serving
|
| 298 |
You should start a vLLM service before parsing documents:
|
| 299 |
```bash
|
| 300 |
cd parsing
|
| 301 |
+
# Serve with DFlash for faster inference
|
| 302 |
+
python serve.py -m ../model_weight/MonkeyOCRv2-B-Parsing -d ../model_weight/MonkeyOCRv2-B-Parsing-DFlash -p 8888
|
| 303 |
+
# Serve without DFlash
|
| 304 |
+
python serve.py -m ../model_weight/MonkeyOCRv2-B-Parsing -p 8888
|
| 305 |
# Show help messages
|
| 306 |
python serve.py -h
|
| 307 |
```
|
|
|
|
| 1259 |
- **MonkeyDoc**: https://modelscope.cn/datasets/zenosai/MonkeyDoc
|
| 1260 |
- **MonkeyDoc v2**: https://modelscope.cn/datasets/zenosai/MonkeyDocv2
|
| 1261 |
|
| 1262 |
+
|
| 1263 |
+
|
| 1264 |
+
|
| 1265 |
## Citation
|
| 1266 |
If you use any part of this release β the MonkeyOCRv2 encoders, MonkeyOCRv2-Parsing,
|
| 1267 |
MonkeyOCRv2-Und, the MDPBench benchmark, or the MonkeyDoc v2 dataset β please cite:
|
|
|
|
| 1279 |
```
|
| 1280 |
|
| 1281 |
## Copyright
|
| 1282 |
+
Share reproductions, integrations, and failure cases in [GitHub Discussions](https://github.com/Yuliang-Liu/MonkeyOCRv2/discussions/13). We warmly welcome your feedback, suggestions, and contributions, which are essential to the continued development and improvement of our framework. The models are are released under the [Apache License 2.0](LICENSE) and are free for both research and commercial use. For any questions, please contact us at xbai@hust.edu.cn or ylliu@hust.edu.cn.
|