Downloads · 30 days
0
ejaz111/t5-synthetic-data-vampyre-ocr-correction
t5-synthetic-data-vampyre-ocr-correction is a machine learning model from ejaz111. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This model is a fine-tuned version of google-t5/t5-base for correcting OCR errors in historical texts, specifically trained on "The Vampyre" dataset.
Downloads · 30 days
0
Access
Public
Updated Nov 6, 2025
Repo size
4.4 MB
Likes
0
Public
Click a slice to open those files.
.safetensors3.6 MB · 52%
From the Hugging Face model README
This model is a fine-tuned version of google-t5/t5-base for correcting OCR errors in historical texts, specifically trained on "The Vampyre" dataset.
Evaluated on real historical OCR text from "The Vampyre":
| Metric | Score |
|---|---|
| Character Error Rate (CER) | 13.93% |
| Word Error Rate (WER) | 22.52% |
| Exact Match | 1.97% |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("ejaz111/t5-synthetic-data-vampyre-ocr-correction")
model = AutoModelForSeq2SeqLM.from_pretrained("ejaz111/t5-synthetic-data-vampyre-ocr-correction")
# Correct OCR errors
ocr_text = "Th1s 1s an 0CR err0r w1th m1stakes in the anc1ent text."
input_ids = tokenizer(ocr_text, return_tensors="pt", max_length=512, truncation=True).input_ids
outputs = model.generate(input_ids, max_length=512)
corrected_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(f"Original: {ocr_text}")
print(f"Corrected: {corrected_text}")
from transformers import pipeline
corrector = pipeline("text2text-generation", model="ejaz111/t5-synthetic-data-vampyre-ocr-correction")
result = corrector("The breeze wh15pered so7tly through the anci3nt tre55")[0]['generated_text']
print(result)
# Output: "The breeze whispered softly through the ancient trees"
The synthetic training data included these OCR error types:
The model showed consistent improvement:
This model is particularly effective for:
| Original OCR | Corrected Output |
|---|---|
| "Th1s 1s an 0CR err0r" | "This is an OCR error" |
| "The anci3nt tre55" | "The ancient trees" |
| "bl0omiNg floweRs" | "blooming flowers" |
If you use this model in your research, please cite:
@misc{t5-vampyre-ocr,
author = {Ejaz},
title = {T5 Base OCR Error Correction for Historical Texts},
year = {2025},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/ejaz111/t5-synthetic-data-vampyre-ocr-correction}}
}
Ejaz - Master's Student in AI and Robotics
Apache 2.0