buddhist-nlp/bdrc-mitra-ocr-qwen35-0.8b
0225
BDRC-MITRA Tibetan OCR (Qwen3.5-0.8B)
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.
Quick start (vLLM, recommended)
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.4import 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)Quick start (transformers)
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))Usage notes
- Prompt: use exactly
Extract all text from this image— this is the instruction the model was tuned for. - Decoding: greedy (
temperature 0.0) works well;max_tokens 2048covers a dense pecha page. - Image size: best results with the page's longest edge around 1500–2000 px (≤ ~5 MP). Very large scans should be downsized first.
- Input: one page (or one clearly cropped text region) per request. Full-page photographs work; extreme skew or heavy borders reduce quality.
- Output: plain Tibetan Unicode, one line per physical line of the page, separated by
\n. No markup or coordinates.
Intended use
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.
