Instructions to use yzk/trocr-large-printed-sanskrit-iso-preadapt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yzk/trocr-large-printed-sanskrit-iso-preadapt with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # pip install "transformers<5.0.0" from transformers import pipeline pipe = pipeline("image-to-text", model="yzk/trocr-large-printed-sanskrit-iso-preadapt")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("yzk/trocr-large-printed-sanskrit-iso-preadapt") model = AutoModelForMultimodalLM.from_pretrained("yzk/trocr-large-printed-sanskrit-iso-preadapt", device_map="auto") - Notebooks
- Google Colab
- Kaggle
trocr-large-printed-sanskrit-iso-preadapt
A TrOCR model fine-tuned from microsoft/trocr-large-printed to transcribe
printed Devanagari Sanskrit line images directly into ISO 15919 romanization.
It is the shared initialization of all models in
yzk/trocr-vedic-cross-notation-rv-ms.
- Input: one printed Devanagari text-line (or word) image.
- Output: ISO 15919 romanization, unaccented (no Vedic accent marks).
- Parameters: 609,169,408 (encoder 304,666,624 / decoder 304,502,784).
Training data
9,681 real printed Devanagari Sanskrit images (non-Vedic, no accent marks) with ISO 15919 targets, from two public Hugging Face datasets:
| Source | train | val | test | License |
|---|---|---|---|---|
| Process-Venue/Sanskrit-OCR-Typed-Dataset | 3,085 | 171 | 171 | CC BY-NC-SA 4.0 |
| diabolic6045/sanskrit-ocr-parallel-corpus-chat-template | 5,630 | 312 | 312 | not stated on the dataset card |
License note. This model is released under CC BY-NC-SA 4.0 to respect the share-alike, non-commercial terms of the Process-Venue dataset. The diabolic6045 dataset does not state a license, and the origin of its images is not documented; rights in that data remain with their holders. Contact the author if you hold rights in this data and have concerns.
Training
3 epochs, learning rate 2e-5, linear schedule with warmup ratio 0.05, batch size 4
per device. The base model microsoft/trocr-large-printed is released under the
MIT license as part of microsoft/unilm.
Usage
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
from PIL import Image
repo = "yzk/trocr-large-printed-sanskrit-iso-preadapt"
processor = TrOCRProcessor.from_pretrained(repo)
model = VisionEncoderDecoderModel.from_pretrained(repo)
pixel_values = processor(Image.open("line.png").convert("RGB"), return_tensors="pt").pixel_values
ids = model.generate(pixel_values, num_beams=4, max_length=256)
print(processor.batch_decode(ids, skip_special_tokens=True)[0])
Citation
@inproceedings{TODO-paclic2026,
title = {Transfer Between Accent Notations in Vedic OCR: Learning Visual Conventions from Parallel Text},
author = {TODO},
booktitle = {Proceedings of the 40th Pacific Asia Conference on Language, Information and Computation (PACLIC 2026)},
year = {2026}
}
- Downloads last month
- 14