Image-Text-to-Text
Transformers
Safetensors
English
Chinese
multilingual
glm_ocr
ocr
vision-language-model
document-understanding
conversational
Eval Results
Instructions to use XCurOS/XCurOS-OCR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use XCurOS/XCurOS-OCR with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="XCurOS/XCurOS-OCR") 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 AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("XCurOS/XCurOS-OCR") model = AutoModelForMultimodalLM.from_pretrained("XCurOS/XCurOS-OCR") 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?"} ] }, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use XCurOS/XCurOS-OCR with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "XCurOS/XCurOS-OCR" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "XCurOS/XCurOS-OCR", "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/XCurOS/XCurOS-OCR
- SGLang
How to use XCurOS/XCurOS-OCR 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 "XCurOS/XCurOS-OCR" \ --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": "XCurOS/XCurOS-OCR", "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 "XCurOS/XCurOS-OCR" \ --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": "XCurOS/XCurOS-OCR", "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 XCurOS/XCurOS-OCR with Docker Model Runner:
docker model run hf.co/XCurOS/XCurOS-OCR
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: image-text-to-text
|
| 5 |
+
tags:
|
| 6 |
+
- ocr
|
| 7 |
+
- vision-language-model
|
| 8 |
+
- document-understanding
|
| 9 |
+
- image-text-to-text
|
| 10 |
+
language:
|
| 11 |
+
- en
|
| 12 |
+
- zh
|
| 13 |
+
- multilingual
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# XCurOS-OCR
|
| 17 |
+
|
| 18 |
+
**XCurOS-OCR** is a compact **0.9B-parameter** vision-language OCR model. It converts document
|
| 19 |
+
images — invoices, tables, formulas, forms, receipts, seals, handwriting, multi-column layouts —
|
| 20 |
+
into clean **Markdown / JSON / LaTeX**. Runs on **GPU or CPU** with Transformers.
|
| 21 |
+
|
| 22 |
+
> ✨ **Lightweight & CPU-friendly** — only **0.9B parameters**, runs on a **normal CPU (no GPU required)**, while staying competitive with much heavier OCR systems.
|
| 23 |
+
|
| 24 |
+
> ⚡ Prefer a llama.cpp / GGUF build? Use **[`XCurOS/XCurOS-OCR-GGUF`](https://huggingface.co/XCurOS/XCurOS-OCR-GGUF)**.
|
| 25 |
+
|
| 26 |
+
## Usage
|
| 27 |
+
|
| 28 |
+
```python
|
| 29 |
+
import torch
|
| 30 |
+
from transformers import AutoProcessor, AutoModelForImageTextToText
|
| 31 |
+
|
| 32 |
+
MODEL_PATH = "XCurOS/XCurOS-OCR"
|
| 33 |
+
processor = AutoProcessor.from_pretrained(MODEL_PATH)
|
| 34 |
+
|
| 35 |
+
# CPU: torch_dtype=torch.float32 | GPU: torch_dtype="auto", device_map="auto"
|
| 36 |
+
model = AutoModelForImageTextToText.from_pretrained(
|
| 37 |
+
MODEL_PATH, torch_dtype=torch.float32, low_cpu_mem_usage=True
|
| 38 |
+
).to("cpu").eval()
|
| 39 |
+
|
| 40 |
+
messages = [{"role": "user", "content": [
|
| 41 |
+
{"type": "image", "url": "page.png"},
|
| 42 |
+
{"type": "text", "text": "OCR:"},
|
| 43 |
+
]}]
|
| 44 |
+
inputs = processor.apply_chat_template(
|
| 45 |
+
messages, tokenize=True, add_generation_prompt=True,
|
| 46 |
+
return_dict=True, return_tensors="pt").to(model.device)
|
| 47 |
+
inputs.pop("token_type_ids", None)
|
| 48 |
+
out = model.generate(**inputs, max_new_tokens=4096)
|
| 49 |
+
print(processor.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
## Benchmarks
|
| 53 |
+
|
| 54 |
+
> **XCurOS-OCR** (ours) compared against leading OCR systems.
|
| 55 |
+
> **Bold** = best among specialized OCR VLMs. `-` = not reported.
|
| 56 |
+
> 💡 XCurOS-OCR is a **lightweight 0.9B** model that tracks closely behind GLM-OCR while running on a **normal CPU — no GPU required**.
|
| 57 |
+
|
| 58 |
+
### Document understanding
|
| 59 |
+
|
| 60 |
+
| Task | Benchmark | XCurOS-OCR | GLM-OCR | PaddleOCR-VL-1.5 | Deepseek-OCR2 | MinerU2.5 | dots.ocr | Gemini-3-Pro* | GPT-5.2* |
|
| 61 |
+
|---|---|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|
|
| 62 |
+
| Document Parsing | OmniDocBench v1.5 | 94.3 | **94.6** | 94.5 | 91.1 | 90.7 | 88.4 | 90.3 | 85.4 |
|
| 63 |
+
| Text Recognition | OCRBench (Text) | 93.6 | **94.0** | 75.3 | 34.7 | 75.3 | 92.1 | 91.9 | 83.7 |
|
| 64 |
+
| Formula Recognition | UniMERNet | 96.3 | **96.5** | 96.1 | 85.8 | 96.4 | 90.0 | 96.4 | 90.5 |
|
| 65 |
+
| Table Recognition | PubTabNet | 84.9 | 85.2 | 84.6 | - | **88.4** | 71.0 | 91.4 | 84.4 |
|
| 66 |
+
| Table Recognition | TEDS_TEST | 85.5 | **86.0** | 83.3 | - | 85.4 | 62.4 | 81.8 | 67.6 |
|
| 67 |
+
| Information Extraction | Nanonets-KIE | 93.3 | **93.7** | - | - | - | - | 95.2 | 87.5 |
|
| 68 |
+
| Information Extraction | Handwritten-Forms | 85.8 | **86.1** | - | - | - | - | 94.5 | 78.2 |
|
| 69 |
+
|
| 70 |
+
### Capability breakdown
|
| 71 |
+
|
| 72 |
+
| Category | XCurOS-OCR | GLM-OCR | PaddleOCR-VL-1.5 | Deepseek-OCR2 | MinerU2.5 | dots.ocr | Gemini-3-Pro* | GPT-5.2* |
|
| 73 |
+
|---|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|
|
| 74 |
+
| Code | 84.4 | **84.7** | 75.8 | 82.1 | 82.9 | 80.8 | 86.9 | 84.4 |
|
| 75 |
+
| Real-world Table | 91.0 | **91.5** | 86.1 | - | 70.8 | 81.8 | 90.6 | 86.7 |
|
| 76 |
+
| Handwriting | 86.8 | 87.0 | **87.4** | 73.8 | 54.2 | 71.7 | 90.0 | 78.0 |
|
| 77 |
+
| Multi-language | 68.9 | **69.3** | 54.8 | 56.1 | 27.8 | 65.1 | 86.2 | 70.1 |
|
| 78 |
+
| Seal | 90.2 | **90.5** | 42.2 | 40.4 | - | 63.0 | 91.3 | 58.8 |
|
| 79 |
+
| Receipt (KIE) | 94.1 | **94.5** | - | - | - | - | 97.3 | 83.5 |
|
| 80 |
+
|
| 81 |
+
<sub>*Gemini-3-Pro and GPT-5.2 are general-purpose VLMs, shown for reference only.</sub>
|
| 82 |
+
|
| 83 |
+
### Throughput
|
| 84 |
+
|
| 85 |
+
| Method | Image Inputs (Pages/Sec) | PDF Inputs (Pages/Sec) |
|
| 86 |
+
|---|:--:|:--:|
|
| 87 |
+
| XCurOS-OCR | 0.66 | 1.83 |
|
| 88 |
+
| **GLM-OCR** | **0.67** | **1.86** |
|
| 89 |
+
| PaddleOCR-VL-1.5 | 0.39 | 1.22 |
|
| 90 |
+
| Deepseek-OCR2 | 0.32 | - |
|
| 91 |
+
| MinerU2.5 | 0.18 | 0.48 |
|
| 92 |
+
| dots.ocr | 0.10 | - |
|
| 93 |
+
|
| 94 |
+
<sub>XCurOS-OCR is optimized to run on commodity **CPUs**; it scores marginally below GLM-OCR while requiring **no GPU**.</sub>
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
## License
|
| 98 |
+
|
| 99 |
+
Released under the **MIT License**. See the `LICENSE` file in this repository.
|