Views
No views yet


2025.11.07 🚀 Enabled flash-attn in the transformers library to achieve faster inference with PaddleOCR-VL-0.9B.2025.11.04 🌟 PaddleOCR-VL-0.9B is now officially supported on vLLM .2025.10.29 🤗 Supports calling the core module PaddleOCR-VL-0.9B of PaddleOCR-VL via the transformers library.2025.10.16 🚀 We release PaddleOCR-VL, — a multilingual documents parsing via a 0.9B Ultra-Compact Vision-Language Model with SOTA performance.1# The following command installs the PaddlePaddle version for CUDA 12.6. For other CUDA versions and the CPU version, please refer to https://www.paddlepaddle.org.cn/en/install/quick?docurl=/documentation/docs/en/develop/install/pip/linux-pip_en.html
2python -m pip install paddlepaddle-gpu==3.2.1 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
3python -m pip install -U "paddleocr[doc-parser]"
4# For Linux systems, run:
5python -m pip install https://paddle-whl.bj.bcebos.com/nightly/cu126/safetensors/safetensors-0.6.2.dev0-cp38-abi3-linux_x86_64.whl
6# For Windows systems, run:
7python -m pip install https://xly-devops.cdn.bcebos.com/safetensors-nightly/safetensors-0.6.2.dev0-cp38-abi3-win_amd64.whlPlease ensure that you install PaddlePaddle framework version 3.2.1 or above, along with the special version of safetensors. For macOS users, please use Docker to set up the environment.
paddleocr doc_parser -i https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/paddleocr_vl_demo.png1from paddleocr import PaddleOCRVL
2pipeline = PaddleOCRVL(pipeline_version="v1")
3output = pipeline.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/paddleocr_vl_demo.png")
4for res in output:
5 res.print()
6 res.save_to_json(save_path="output")
7 res.save_to_markdown(save_path="output")1docker run \
2 --rm \
3 --gpus all \
4 --network host \
5 ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddleocr-genai-vllm-server:latest \
6 paddleocr genai_server --model_name PaddleOCR-VL-0.9B --host 0.0.0.0 --port 8080 --backend vllm1paddleocr doc_parser \
2 -i https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/paddleocr_vl_demo.png \
3 --vl_rec_backend vllm-server \
4 --vl_rec_server_url http://127.0.0.1:8080/v11from paddleocr import PaddleOCRVL
2pipeline = PaddleOCRVL(vl_rec_backend="vllm-server", vl_rec_server_url="http://127.0.0.1:8080/v1")
3output = pipeline.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/paddleocr_vl_demo.png")
4for res in output:
5 res.print()
6 res.save_to_json(save_path="output")
7 res.save_to_markdown(save_path="output")transformers library, which can recognize texts, formulas, tables, and chart elements. In the future, we plan to support full document parsing inference with transformers. Below is a simple script we provide to support inference using the PaddleOCR-VL-0.9B model with transformers.[!NOTE] Note: We currently recommend using the official method for inference, as it is faster and supports page-level document parsing. The example code below only supports element-level recognition.
1from PIL import Image
2import torch
3from transformers import AutoModelForCausalLM, AutoProcessor
4
5# ---- Settings ----
6model_path = "PaddlePaddle/PaddleOCR-VL"
7image_path = "test.png"
8task = "ocr" # Options: 'ocr' | 'table' | 'chart' | 'formula'
9# ------------------
10
11DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
12
13PROMPTS = {
14 "ocr": "OCR:",
15 "table": "Table Recognition:",
16 "formula": "Formula Recognition:",
17 "chart": "Chart Recognition:",
18}
19
20image = Image.open(image_path).convert("RGB")
21
22model = AutoModelForCausalLM.from_pretrained(
23 model_path, trust_remote_code=True, torch_dtype=torch.bfloat16
24).to(DEVICE).eval()
25processor = AutoProcessor.from_pretrained(model_path, trust_remote_code=True)
26
27messages = [
28 {"role": "user",
29 "content": [
30 {"type": "image", "image": image},
31 {"type": "text", "text": PROMPTS[task]},
32 ]
33 }
34]
35inputs = processor.apply_chat_template(
36 messages,
37 tokenize=True,
38 add_generation_prompt=True,
39 return_dict=True,
40 return_tensors="pt"
41).to(DEVICE)
42
43outputs = model.generate(**inputs, max_new_tokens=1024)
44outputs = processor.batch_decode(outputs, skip_special_tokens=True)[0]
45print(outputs)1# ensure the flash-attn2 is installed
2pip install flash-attn --no-build-isolation1import torch
2from transformers import AutoModelForCausalLM, AutoProcessor
3from PIL import Image
4
5# ---- Settings ----
6model_path = "PaddlePaddle/PaddleOCR-VL"
7image_path = "test.png"
8task = "ocr" # ← change to "table" | "chart" | "formula"
9# ------------------
10
11DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
12
13model = AutoModelForCausalLM.from_pretrained(
14 model_path,
15 trust_remote_code=True,
16 torch_dtype=torch.bfloat16,
17 attn_implementation="flash_attention_2",
18).to(dtype=torch.bfloat16, device=DEVICE).eval()
19processor = AutoProcessor.from_pretrained(model_path, trust_remote_code=True)
20
21PROMPTS = {
22 "ocr": "OCR:",
23 "table": "Table Recognition:",
24 "chart": "Chart Recognition:",
25 "formula": "Formula Recognition:",
26}
27messages = [
28 {
29 "role": "user",
30 "content": [
31 {"type": "image", "image": Image.open(image_path).convert("RGB")},
32 {"type": "text", "text": PROMPTS[task]}
33 ]
34 }
35]
36
37inputs = processor.apply_chat_template(
38 messages,
39 tokenize=True,
40 add_generation_prompt=True,
41 return_dict=True,
42 return_tensors="pt"
43).to(DEVICE)
44
45with torch.inference_mode():
46 out = model.generate(
47 **inputs,
48 max_new_tokens=1024,
49 do_sample=False,
50 use_cache=True
51 )
52
53outputs = processor.batch_decode(out, skip_special_tokens=True)[0]
54print(outputs)

Notes:
- The metrics are from MinerU, OmniDocBench, and our own internal evaluations.

















1@misc{cui2025paddleocrvlboostingmultilingualdocument,
2 title={PaddleOCR-VL: Boosting Multilingual Document Parsing via a 0.9B Ultra-Compact Vision-Language Model},
3 author={Cheng Cui and Ting Sun and Suyin Liang and Tingquan Gao and Zelun Zhang and Jiaxuan Liu and Xueqing Wang and Changda Zhou and Hongen Liu and Manhui Lin and Yue Zhang and Yubo Zhang and Handong Zheng and Jing Zhang and Jun Zhang and Yi Liu and Dianhai Yu and Yanjun Ma},
4 year={2025},
5 eprint={2510.14528},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://arxiv.org/abs/2510.14528},
9}