Image-Text-to-Text
Transformers
Joblib
Safetensors
English
qwen3_5
ocr
pdf
markdown
document-parsing
tables
charts
parsebench
conversational
Eval Results
Instructions to use suryatmodulus/OCRia-1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use suryatmodulus/OCRia-1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="suryatmodulus/OCRia-1") 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 AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("suryatmodulus/OCRia-1") model = AutoModelForMultimodalLM.from_pretrained("suryatmodulus/OCRia-1", device_map="auto") 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 = processor.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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use suryatmodulus/OCRia-1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "suryatmodulus/OCRia-1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "suryatmodulus/OCRia-1", "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/suryatmodulus/OCRia-1
- SGLang
How to use suryatmodulus/OCRia-1 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 "suryatmodulus/OCRia-1" \ --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": "suryatmodulus/OCRia-1", "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 "suryatmodulus/OCRia-1" \ --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": "suryatmodulus/OCRia-1", "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 suryatmodulus/OCRia-1 with Docker Model Runner:
docker model run hf.co/suryatmodulus/OCRia-1
Download tests/test_fast_layout.py from suryatmodulus/OCRia-1: direct link, hf CLI and curl.
- Browser
- Download file 2.33 kB
-
https://huggingface.co/suryatmodulus/OCRia-1/resolve/main/tests/test_fast_layout.py
- Command line
-
hf download hf://suryatmodulus/OCRia-1/tests/test_fast_layout.py
-
curl -L -o test_fast_layout.py https://huggingface.co/suryatmodulus/OCRia-1/resolve/main/tests/test_fast_layout.py
2.33 kB
| # Copyright (c) 2026 LlamaIndex, Inc. All rights reserved. | |
| # Licensed under the OCRia-1 Model and Code License (LICENSE at the root of this repository). | |
| # This is not open-source software: see the license for permitted uses. | |
| """Capture adapter regressions: raster isolation, coordinate frames, and top-k retention.""" | |
| from typing import Any | |
| import numpy as np | |
| import pytest | |
| from parse_rl_utils.ocria_attention_grounding.hf_adapter import ground_fast_layout | |
| class DimensionsOnly: | |
| size = (600, 300) | |
| def convert(self, *_args: Any) -> None: | |
| raise AssertionError("Cached grounding must not read raster pixels") | |
| class RecordingBackend: | |
| def __init__(self) -> None: | |
| self.capture: dict = {} | |
| def __call__(self, *, answer: str, attention: dict) -> dict: | |
| self.capture = attention | |
| return {"timings_ms": {}, "items": []} | |
| def test_cached_attention_skips_gpu_and_raster_and_rejects_wrong_frame() -> None: | |
| backend = RecordingBackend() | |
| capture = {"width": 600, "height": 300} | |
| page = ground_fast_layout( | |
| None, DimensionsOnly(), "word", backend=backend, attention=capture | |
| ) | |
| assert page["attention_source"] == "precomputed" | |
| assert page["timings_ms"]["attention_capture"] == 0 | |
| with pytest.raises(ValueError, match="coordinate frame"): | |
| ground_fast_layout( | |
| None, | |
| DimensionsOnly(), | |
| "word", | |
| backend=backend, | |
| attention={"width": 300, "height": 600}, | |
| ) | |
| def test_live_capture_keeps_512_cells_and_missing_unit_alignment() -> None: | |
| class Grounder: | |
| def unit_maps(self, image: Any, answer: str, units: list) -> tuple: | |
| assert [answer[start:end] for start, end in units] == ["first", "second"] | |
| return ( | |
| np.arange(1200, dtype=np.float32).reshape(2, 20, 30), | |
| (20, 30), | |
| [True, False], | |
| ) | |
| backend = RecordingBackend() | |
| page = ground_fast_layout( | |
| Grounder(), DimensionsOnly(), "first second", backend=backend | |
| ) | |
| sparse = backend.capture["sparse_maps"] | |
| assert set(sparse["idx"][0]) == set(range(88, 600)) | |
| assert sparse["idx"][1] == [] | |
| assert sparse["val"][1] == [] | |
| assert sparse["has"] == [True, False] | |
| assert page["attention_source"] == "teacher-forced" | |