MITRA-BDRC
Collection
OCR models for Tibetan sources, built in collaboration with the Buddhist Digital Resource Center (BDRC). • 2 items • Updated
End-to-end page-level OCR for Tibetan texts. Give it a page image, get back the transcription as plain Unicode Tibetan text with one line of text per line of the page. Handles both dbu can (uchen) and dbu med (umed) scripts across woodblock prints, manuscripts, and modern print.
Built on Qwen/Qwen3.5-0.8B; use it like any Qwen3.5-VL-style model.
vllm serve buddhist-nlp/bdrc-mitra-ocr-qwen35-0.8b \
--served-model-name ocr --trust-remote-code \
--max-model-len 16384 --gpu-memory-utilization 0.4
import base64
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="none")
with open("page.jpg", "rb") as f:
b64 = base64.b64encode(f.read()).decode()
resp = client.chat.completions.create(
model="ocr",
messages=[{
"role": "user",
"content": [
{"type": "image_url",
"image_url": {"url": f"data:image/jpeg;base64,{b64}"}},
{"type": "text", "text": "Extract all text from this image"},
],
}],
temperature=0.0,
max_tokens=2048,
)
print(resp.choices[0].message.content)
import torch
from transformers import AutoModelForImageTextToText, AutoProcessor
from PIL import Image
model_id = "buddhist-nlp/bdrc-mitra-ocr-qwen35-0.8b"
model = AutoModelForImageTextToText.from_pretrained(
model_id, dtype=torch.bfloat16, device_map="cuda", trust_remote_code=True
)
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
image = Image.open("page.jpg").convert("RGB")
messages = [{
"role": "user",
"content": [
{"type": "image", "image": image},
{"type": "text", "text": "Extract all text from this image"},
],
}]
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=2048, do_sample=False)
print(processor.decode(out[0][inputs["input_ids"].shape[1]:],
skip_special_tokens=True))
Extract all text from this image — this is the
instruction the model was tuned for.temperature 0.0) works well; max_tokens 2048
covers a dense pecha page.\n. No markup or coordinates.Transcription of Tibetan xylographs, manuscripts, and prints, e.g. for digitization pipelines, search indexing, and downstream NLP. Expect lower accuracy on heavily degraded or highly cursive umed manuscripts — always proofread results destined for publication.