Views
No views yet
1from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2import torch
3
4model_name = "manavdhamecha77/GEC-mT5-Small-Tamil"
5
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
8
9device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
10model.to(device)
11
12sentences = [
13 "நான் பள்ளிக்கு போகிறேன்", # example Tamil sentence
14]
15
16inputs = ["correct this: " + s for s in sentences]
17
18encoded = tokenizer(
19 inputs,
20 return_tensors="pt",
21 padding=True,
22 truncation=True,
23 max_length=128
24).to(device)
25
26outputs = model.generate(**encoded, max_length=128, num_beams=4)
27corrected = tokenizer.batch_decode(outputs, skip_special_tokens=True)
28
29for orig, corr in zip(sentences, corrected):
30 print(f"Input: {orig}")
31 print(f"Corrected: {corr}\n")| Parameter | Value |
|---|---|
| Optimizer | AdamW |
| Learning Rate | 5e-5 |
| Batch Size | 16–32 |
| Epochs | 10–15 |
| Max Sequence Length | 128 |
| Early Stopping | Based on GLEU (dev set) |
"correct this: <incorrect sentence>"| Language | Model | GLEU |
|---|---|---|
| Tamil | mT5-small | 86.03 |
1@inproceedings{dhamecha2025horizon,
2 title = {Team Horizon at {BHASHA} Task 1: Multilingual {IndicGEC} with Transformer-based Grammatical Error Correction Models},
3 author = {Dhamecha, Manav and Damor, Gaurav and Choudhary, Sunil and Mishra, Pruthwik},
4 booktitle = {Proceedings of the 1st Workshop on Benchmarks, Harmonization, Annotation, and Standardization for Human-Centric AI in Indian Languages (BHASHA 2025)},
5 year = {2025},
6 url = {https://aclanthology.org/2025.bhasha-1.14/}
7}