altslate/indic-ocr-0.9b
Compact OCR for Indian Languages
2 min readupdated
A 960M-parameter optical character recognition (OCR) model built on PaddleOCR-VL-1.6. It takes an image of a single text block (paragraph, line, or heading) as input and returns the recognized text. The model supports 23 languages (including English and 22 Indian languages) and is distributed under the Apache-2.0 license with no commercial restrictions. It excels at rare scripts like Meitei Mayek (Manipuri) and Ol Chiki (Santhali), outperforming even larger alternatives.
Key features
- Strong metrics: Outperforms the 7B Patram 1.5 model on the Sarvam Indic OCR Bench despite its smaller size.
- Rare scripts: Accurately reads text in Manipuri (Meitei Mayek script) and Santhali (Ol Chiki).
- Fast inference: Supports running via the vLLM library with ready-to-use examples.
- Block-based processing: The model processes individual text blocks, so pages must be cropped into fragments before recognition.
What you can do
- Integrate into digitization pipelines: Set up an automated recognition service for Indian press, books, and documents using vLLM.
- Run locally: Implement image processing in a Python script using transformers (version 5.0 and above).
- Process multilingual archives: Use the model for projects requiring support for regional Indian languages and rare fonts.
Example
Running the model via transformers in Python:
import torch
from PIL import Image
from transformers import AutoProcessor, AutoModelForImageTextToText
model = AutoModelForImageTextToText.from_pretrained("altslate/indic-ocr-0.9b", dtype=torch.bfloat16).to("cuda").eval()
processor = AutoProcessor.from_pretrained("altslate/indic-ocr-0.9b")
image = Image.open("block.png").convert("RGB")
messages = [{"role": "user", "content": [{"type": "image", "image": image}, {"type": "text", "text": "OCR:"}]}]
inputs = processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=True, return_dict=True,
return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=1024, do_sample=False, repetition_penalty=1.05)
print(processor.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))Read more
Details• Accuracy on the full Sarvam Indic OCR Bench test is 59.2% (word-level accuracy).
• The model struggles more with Odia, Malayalam, Kannada, and Urdu due to synthetic data limitations.
• Trained on 150,000 synthetic block images using fonts from the Ubuntu archive and Google Fonts.
• Requires token length limits and a repetition_penalty of around 1.05 to prevent repetition loops.










Comments