Image-Text-to-Text
Transformers
Safetensors
Sanskrit
qwen3_5
ocr
sanskrit
devanagari
document-ocr
sansar
conversational
Eval Results (legacy)
Instructions to use MuseMesh/sansar-ocr-2b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MuseMesh/sansar-ocr-2b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="MuseMesh/sansar-ocr-2b") 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("MuseMesh/sansar-ocr-2b") model = AutoModelForMultimodalLM.from_pretrained("MuseMesh/sansar-ocr-2b", 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 MuseMesh/sansar-ocr-2b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MuseMesh/sansar-ocr-2b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MuseMesh/sansar-ocr-2b", "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/MuseMesh/sansar-ocr-2b
- SGLang
How to use MuseMesh/sansar-ocr-2b 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 "MuseMesh/sansar-ocr-2b" \ --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": "MuseMesh/sansar-ocr-2b", "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 "MuseMesh/sansar-ocr-2b" \ --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": "MuseMesh/sansar-ocr-2b", "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 MuseMesh/sansar-ocr-2b with Docker Model Runner:
docker model run hf.co/MuseMesh/sansar-ocr-2b
Download eval/verification.json from MuseMesh/sansar-ocr-2b: direct link, hf CLI and curl.
- Browser
- Download file 2.51 kB
-
https://huggingface.co/MuseMesh/sansar-ocr-2b/resolve/main/eval/verification.json
- Command line
-
hf download hf://MuseMesh/sansar-ocr-2b/eval/verification.json
-
curl -L -o verification.json https://huggingface.co/MuseMesh/sansar-ocr-2b/resolve/main/eval/verification.json
2.51 kB
| { | |
| "check": "median letter CER of the staged weights on the 54 bench_v1 test pages (score_pages.py via report_eval.py) within 0.003 of the recorded HF cross-check", | |
| "passed": true, | |
| "staged_dir": "/run/media/kushal/Kush/sansar/release/hf/sansar-ocr-2b-clean/v0.1.0", | |
| "engine": "transformers generate, release ocr_page.py + release generation_config (greedy)", | |
| "result": { | |
| "n": 54, | |
| "missing": [], | |
| "cer_letters": { | |
| "n": 54, | |
| "median": 0.0105, | |
| "mean": 0.0231 | |
| }, | |
| "cer": { | |
| "n": 54, | |
| "median": 0.035, | |
| "mean": 0.0476 | |
| }, | |
| "groups": { | |
| "footnotes:no": { | |
| "n": 49, | |
| "median": 0.0097, | |
| "mean": 0.0228 | |
| }, | |
| "footnotes:yes": { | |
| "n": 5, | |
| "median": 0.02, | |
| "mean": 0.0253 | |
| }, | |
| "header:no": { | |
| "n": 23, | |
| "median": 0.0097, | |
| "mean": 0.023 | |
| }, | |
| "header:yes": { | |
| "n": 31, | |
| "median": 0.0112, | |
| "mean": 0.0231 | |
| }, | |
| "old_ocr_cer:high": { | |
| "n": 18, | |
| "median": 0.0314, | |
| "mean": 0.0453 | |
| }, | |
| "old_ocr_cer:low": { | |
| "n": 18, | |
| "median": 0.007, | |
| "mean": 0.0129 | |
| }, | |
| "old_ocr_cer:mid": { | |
| "n": 18, | |
| "median": 0.0072, | |
| "mean": 0.011 | |
| }, | |
| "tier:kept": { | |
| "n": 39, | |
| "median": 0.0078, | |
| "mean": 0.0234 | |
| }, | |
| "tier:mid": { | |
| "n": 15, | |
| "median": 0.0131, | |
| "mean": 0.0221 | |
| } | |
| }, | |
| "better_than_google_vision_pages": 38 | |
| }, | |
| "compared_to": { | |
| "OCR-VLM v1.2-clean (HF)": { | |
| "recorded_median": 0.0106, | |
| "recorded_mean": 0.0229, | |
| "pages_identical_cer": 41, | |
| "pages_compared": 54, | |
| "max_page_abs_diff": 0.004, | |
| "median_page_abs_diff": 0.0 | |
| }, | |
| "OCR-VLM v1.2-clean (vLLM)": { | |
| "recorded_median": 0.0106, | |
| "recorded_mean": 0.0227, | |
| "pages_identical_cer": 39, | |
| "pages_compared": 54, | |
| "max_page_abs_diff": 0.0203, | |
| "median_page_abs_diff": 0.0 | |
| } | |
| }, | |
| "rescored_run_transcriptions": { | |
| "run transcriptions, vLLM A100 (re-scored)": { | |
| "n": 54, | |
| "cer_letters": { | |
| "n": 54, | |
| "median": 0.0106, | |
| "mean": 0.0227 | |
| }, | |
| "cer": { | |
| "n": 54, | |
| "median": 0.0354, | |
| "mean": 0.0468 | |
| } | |
| }, | |
| "run transcriptions, HF A100 (re-scored)": { | |
| "n": 54, | |
| "cer_letters": { | |
| "n": 54, | |
| "median": 0.0106, | |
| "mean": 0.0229 | |
| }, | |
| "cer": { | |
| "n": 54, | |
| "median": 0.035, | |
| "mean": 0.0474 | |
| } | |
| } | |
| }, | |
| "timing": { | |
| "pages": 54, | |
| "batch": 4, | |
| "load_seconds": 4.5, | |
| "gen_seconds": 796.0, | |
| "pages_per_hour": 244.2, | |
| "output_tokens": 54542, | |
| "gpu": "NVIDIA GeForce RTX 3060", | |
| "transformers": "5.18.0", | |
| "torch": "2.14.0+cu130" | |
| }, | |
| "date": "2026-10-09 08:01 IST" | |
| } | |