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/check_cuda_layout.py from suryatmodulus/OCRia-1: direct link, hf CLI and curl.
- Browser
- Download file 3.59 kB
-
https://huggingface.co/suryatmodulus/OCRia-1/resolve/main/tests/check_cuda_layout.py
- Command line
-
hf download hf://suryatmodulus/OCRia-1/tests/check_cuda_layout.py
-
curl -L -o check_cuda_layout.py https://huggingface.co/suryatmodulus/OCRia-1/resolve/main/tests/check_cuda_layout.py
3.59 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. | |
| """CUDA smoke: synthetic text/table pages, fast pixel isolation, and legacy stability. | |
| Run from the repository root with PYTHONPATH=. python tests/check_cuda_layout.py. | |
| """ | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| def check(model: str) -> dict: | |
| import time | |
| import numpy as np | |
| import torch | |
| from PIL import Image, ImageDraw, ImageFont | |
| from ocria_grounding import ( | |
| load, | |
| load_fast_layout, | |
| ground_layout, | |
| transcribe, | |
| to_layout_items_page, | |
| ) | |
| import ocria_grounding.layout as layout | |
| import ocria_grounding.ground as legacy_ground | |
| t = time.perf_counter() | |
| g = load(model) | |
| backend = load_fast_layout() | |
| load_seconds = time.perf_counter() - t | |
| result = { | |
| "device": torch.cuda.get_device_name(), | |
| "model_load_seconds": load_seconds, | |
| "pages": [], | |
| } | |
| for index, text in enumerate( | |
| [ | |
| "FAST LAYOUT TEST\n\nA short paragraph on a test page.\nThe second line has more words.", | |
| "INVOICE\n\nItem Quantity Price\nApples 3 6.00\nPears 2 4.00\n\nTotal 10.00", | |
| ] | |
| ): | |
| image = Image.new("RGB", (640, 480), "white") | |
| draw = ImageDraw.Draw(image) | |
| draw.multiline_text( | |
| (35, 35), | |
| text, | |
| fill="black", | |
| font=ImageFont.load_default(size=20), | |
| spacing=14, | |
| ) | |
| started = time.perf_counter() | |
| answer = transcribe(g, image, max_new_tokens=256) | |
| transcription = time.perf_counter() - started | |
| old = ground_layout(g, image, answer) | |
| old_page = layout.Page | |
| def reject_pixels(*args: object, **kwargs: object) -> None: | |
| raise AssertionError("fast-layout touched pixel postprocessing") | |
| layout.Page = reject_pixels | |
| legacy_ground.Page = reject_pixels | |
| try: | |
| fast = ground_layout( | |
| g, image, answer, method="fast-layout", fast_backend=backend | |
| ) | |
| finally: | |
| layout.Page = old_page | |
| legacy_ground.Page = old_page | |
| after = ground_layout(g, image, answer) | |
| assert old == after, "Fast layout changed subsequent default output" | |
| serialized = to_layout_items_page(fast) | |
| for item in fast["items"]: | |
| assert np.isfinite(item["box"]).all() | |
| assert item["box"][2] >= item["box"][0] and item["box"][3] >= item["box"][1] | |
| assert fast["items"], "No fast layout items" | |
| result["pages"].append( | |
| { | |
| "index": index, | |
| "answer": answer, | |
| "default_items": len(old["items"]), | |
| "fast_items": len(fast["items"]), | |
| "default_before_after_equal": True, | |
| "transcription_seconds": transcription, | |
| "timings_ms": fast["timings_ms"], | |
| "serialization_items": len(serialized["items"]), | |
| } | |
| ) | |
| result["peak_gpu_memory_bytes"] = torch.cuda.max_memory_allocated() | |
| return result | |
| if __name__ == "__main__": | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--model", default=str(Path(__file__).resolve().parents[1])) | |
| args = parser.parse_args() | |
| print(json.dumps(check(args.model), indent=2)) | |