Shivalipi-VLM (शिवलिपी) 📜

Shivalipi-VLM is a specialized Vision-Encoder-Decoder model fine-tuned to transcribe historical handwritten Modi Lipi (मोडी लिपी) manuscript lines directly into standard Devanagari Marathi (देवनागरी मराठी).

Developed and maintained by Rohit Manikrao Patil as the official default model backbone for the open-source shivalipi Python library.


Model Overview

  • Architecture: Vision-Encoder-Decoder (TrOCR Small Stage 1 backbone)
  • Primary Task: Optical Character Recognition (OCR) / Historical Line Decipherment
  • Source Script: Modi Lipi (मोडी)
  • Target Script: Devanagari Marathi (देवनागरी)
  • Training Paradigm: Direct visual-to-Devanagari mapping without intermediate transliteration.

Training Data

The model was trained on a stratified blend of synthetic and authentic Maratha-era historical manuscripts:

  • historyHulk/MoDeTrans: Authentic historical Modi line strips with verified Devanagari transcriptions.
  • historyHulk/SynthMoDe: Synthetically generated Modi line variants simulating document degradation, ink bleed, and varied pen strokes.
  • Normalization: Unicode NFC normalization with ligature and diacritic standardization.

Quick Inference with the shivalipi Library

The recommended way to use this model is via the shivalipi Python package:

pip install --upgrade shivalipi
import shivalipi

#Transcribe a Modi line strip image
result = shivalipi.transcribe("sample_modi_line.jpg")
print("Transcribed Marathi Text:")
print(result)

Usage with Hugging Face Transformers

import torch
from PIL import Image
from transformers import TrOCRProcessor, VisionEncoderDecoderModel

device = "cuda" if torch.cuda.is_available() else "cpu"

model_id = "Litap007/shivalipi-vlm"
processor = TrOCRProcessor.from_pretrained(model_id)
model = VisionEncoderDecoderModel.from_pretrained(model_id).to(device)

#Load document image
image = Image.open("sample_modi_line.jpg").convert("RGB")
pixel_values = processor(image, return_tensors="pt").pixel_values.to(device)

#Autoregressive generation
with torch.no_grad():
    generated_ids = model.generate(
        pixel_values,
        max_length=128,
        num_beams=4,
        no_repeat_ngram_size=3,
        early_stopping=True,
    )
    transcription = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]

print("Devanagari Transcription:", transcription)

Evaluation & Metrics

The model is evaluated using Character Error Rate (CER) and Word Error Rate (WER) on normalized Devanagari text:

Built-in Levenshtein alignment handles complex Indic conjuncts and matra positions. All evaluation steps utilize strict Unicode NFC normalization.


Author & Maintainer

Author: Rohit Manikrao Patil.

Website: www.rohitmanikraopatil.com

Github: https://github.com/Litap-AI/shivalipi

PyPI Library: https://pypi.org/project/shivalipi


License

This model and weights are distributed under the Apache-2.0 License.


Downloads last month
-
Safetensors
Model size
61.6M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Datasets used to train Litap007/shivalipi-vlm