DevGen TrOCR Devanagari LoRA Adapter

This repository contains the DevGen LoRA adapter for Devanagari OCR. It is intended to be loaded on top of paudelanil/trocr-devanagari-2 with PEFT.

Model Details

  • Developed by: Sameer Wagle / DevGen
  • Base model: paudelanil/trocr-devanagari-2
  • Adapter type: LoRA
  • Task: image-to-text OCR for Devanagari word and short-line images
  • Library: PEFT + Transformers

Intended Use

Use this adapter for recognizing Devanagari text from cropped handwritten or printed word images. The DevGen runtime also supports light preprocessing such as foreground cropping and square padding for uploaded document-like images.

This model is not a general document understanding system. It does not perform page layout analysis, table extraction, translation, or language correction.

Loading

from peft import PeftModel
from transformers import AutoTokenizer, TrOCRProcessor, ViTImageProcessor, VisionEncoderDecoderModel

base_model_id = "paudelanil/trocr-devanagari-2"
adapter_id = "waglesameer5/devgen-trocr-devanagari-lora"

image_processor = ViTImageProcessor.from_pretrained(adapter_id)
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
processor = TrOCRProcessor(image_processor=image_processor, tokenizer=tokenizer)

base_model = VisionEncoderDecoderModel.from_pretrained(base_model_id)
model = PeftModel.from_pretrained(base_model, adapter_id)

Demo

A hosted Gradio demo is available as a Hugging Face Space:

waglesameer5/devgen-devanagari-ocr

Limitations

The adapter is most reliable on clear Devanagari word or short-line crops. Accuracy can degrade on very noisy images, multi-column documents, severe blur, extreme rotation, or text outside the training distribution.

Training And Evaluation

The adapter was trained in the DevGen OCR workspace using a LoRA fine-tuning workflow for TrOCR. The local project includes reproducible evaluation scripts for corpus character error rate, word error rate, exact match, and preprocessing ablations.

Framework Versions

  • PEFT 0.19.1
  • Transformers
  • PyTorch
Downloads last month
56
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for waglesameer5/devgen-trocr-devanagari-lora

Adapter
(2)
this model

Space using waglesameer5/devgen-trocr-devanagari-lora 1