Run this model with HF Jobs

Run Ransaka/TrOCR-Sinhala on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/Ransaka/TrOCR-Sinhala. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/Ransaka/TrOCR-Sinhala on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

TrOCR-Sinhala

See training metrics tab for performance details.

Model description

This model is finetuned version of Microsoft TrOCR Printed

Intended uses & limitations

More information needed

Training and evaluation data

More information needed

Example

from PIL import Image
import requests
from io import BytesIO

from transformers import TrOCRProcessor, VisionEncoderDecoderModel, AutoTokenizer

image_url = "https://datasets-server.huggingface.co/assets/Ransaka/sinhala_synthetic_ocr/--/bf7c8a455b564cd73fe035031e19a5f39babb73b/--/default/train/0/image/image.jpg"
response = requests.get(image_url)
img = Image.open(BytesIO(response.content))

processor = TrOCRProcessor.from_pretrained('Ransaka/TrOCR-Sinhala')
model = VisionEncoderDecoderModel.from_pretrained('Ransaka/TrOCR-Sinhala')
model.to("cuda:0")

pixel_values = processor(img, return_tensors="pt").pixel_values.to('cuda:0')  
generated_ids = model.generate(pixel_values,num_beams=2,early_stopping=True)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
generated_text #දිවයිනට බලයට ඇති ආපදා තත්ත්වය හමුවේ සබරගමුව පළාතේ

Framework versions

  • Transformers 4.35.2
  • Pytorch 2.0.0
  • Datasets 2.16.0
  • Tokenizers 0.15.0
Downloads last month
66
Safetensors
Model size
0.3B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Ransaka/TrOCR-Sinhala

Finetunes
3 models

Dataset used to train Ransaka/TrOCR-Sinhala