Instructions to use flow3rdown/VenusOCR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use flow3rdown/VenusOCR with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="flow3rdown/VenusOCR", 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("flow3rdown/VenusOCR", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use flow3rdown/VenusOCR with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "flow3rdown/VenusOCR" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "flow3rdown/VenusOCR", "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/flow3rdown/VenusOCR
- SGLang
How to use flow3rdown/VenusOCR 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 "flow3rdown/VenusOCR" \ --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": "flow3rdown/VenusOCR", "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 "flow3rdown/VenusOCR" \ --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": "flow3rdown/VenusOCR", "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 flow3rdown/VenusOCR with Docker Model Runner:
docker model run hf.co/flow3rdown/VenusOCR
VenusOCR 2.0 is a 1B vision-language OCR model built for high-accuracy document recognition. It supports both standard autoregressive inference and optional PTPv2 parallel speculative decoding for faster lossless generation.
This repository hosts the region-level recognition weights. For full-page PDF/image parsing (layout detection, reading-order recovery, and Markdown export), please use the companion VenusOCR SDK.
Highlights
- Unified Region Recognition: Recognizes multi-column text, LaTeX mathematical formulas, and complex tables.
- Compact & Fast: Lightweight 1B-class recognizer designed for efficient single-GPU deployment.
- Optional PTPv2 Acceleration: Bundled parallel draft module (
ptp2/) enables lossless speedup in vLLM serving.
Architecture
Usage
1. Transformers Inference
Install dependencies (pinned transformers==5.5.4 is recommended):
pip install transformers==5.5.4
Run quick inference on a cropped document region image:
python scripts/infer_transformers.py --image /path/to/region.png --task text
Or load directly in Python:
import torch
from PIL import Image
from transformers import AutoModelForCausalLM, AutoProcessor
model_path = "./VenusOCR2-1B"
processor = AutoProcessor.from_pretrained(model_path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_path,
dtype=torch.bfloat16,
attn_implementation="sdpa",
trust_remote_code=True,
).to("cuda:0").eval()
image = Image.open("/path/to/region.png").convert("RGB")
messages = [
{
"role": "user",
"content": [
{"type": "image"},
{"type": "text", "text": "Text Recognition:"},
],
}
]
prompt = processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
inputs = processor(images=image, text=prompt, return_tensors="pt").to(model.device)
with torch.inference_mode():
output_ids = model.generate(**inputs, max_new_tokens=2048, do_sample=False)
generated_ids = output_ids[:, inputs["input_ids"].shape[1]:]
print(processor.batch_decode(generated_ids, skip_special_tokens=True)[0])
Task Prompts
| Task | Prompt | Output Format |
|---|---|---|
| Text | Text Recognition: |
Plain text / Markdown |
| Formula | Formula Recognition: |
LaTeX |
| Table | Table Recognition: |
OTSL structure |
2. vLLM
Standard Mode (AR)
If you have the VenusOCR SDK installed, launch the OpenAI-compatible server directly:
venusocr serve ./VenusOCR2-1B --host 127.0.0.1 --port 8000
Or launch standalone without the SDK (using vllm==0.20.0 and transformers==5.5.4):
pip install "vllm==0.20.0" "transformers==5.5.4"
bash scripts/patch_vllm_v0_20_ptp2.sh
USE_PTP2=0 HOST=127.0.0.1 PORT=8000 bash scripts/vllm_serve_ptp2.sh
Accelerated Mode (Optional PTPv2)
With the vLLM patch applied (bash scripts/patch_vllm_v0_20_ptp2.sh --reverse to undo):
HOST=127.0.0.1 PORT=8000 bash scripts/vllm_serve_ptp2.sh
Common environment overrides: CUDA_VISIBLE_DEVICES, HOST, PORT, USE_PTP2 (1 by default, 0 for AR), GPU_MEMORY_UTILIZATION, MAX_MODEL_LEN, MAX_NUM_SEQS.
4. End-to-End Document Parsing
For full-page PDF and image parsing (layout detection, reading order, and Markdown export), use the VenusOCR SDK:
git clone https://github.com/flow3rdown/VenusOCR.git
cd VenusOCR
pip install -e '.[transformers,serve]'
venusocr parse document.pdf -o ./output --server-url http://127.0.0.1:8000/v1
Citation
If you find VenusOCR 2.0 useful in your research or applications, please consider citing:
@misc{venusocr2026,
title={VenusOCR2.0: Towards Efficient and Effective Document Parsing},
author={Lei Li and Zheng Wei and Yi Yuan and Qingbin Liu and Jiang Bian and Zang Li},
year={2026},
eprint={2611.32617},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2611.32617}
}
Acknowledgements
We thank the SigLIP2, Qwen3, PaddleOCR / PP-DocLayoutV3, vLLM, and OmniDocBench communities.
- Downloads last month
- -
docker model run hf.co/flow3rdown/VenusOCR