Views
No views yet
1from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2import torch
3
4model_name = "manavdhamecha77/GEC-mT5-Small-Bangla"
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 "আমি স্কুলে যাই",
14 "সে বাড়ি গেছিলাম",
15]
16
17inputs = ["correct this: " + s for s in sentences]
18
19encoded = tokenizer(
20 inputs,
21 return_tensors="pt",
22 padding=True,
23 truncation=True,
24 max_length=128
25).to(device)
26
27outputs = model.generate(**encoded, max_length=128, num_beams=4)
28corrected = tokenizer.batch_decode(outputs, skip_special_tokens=True)
29
30for orig, corr in zip(sentences, corrected):
31 print(f"Input: {orig}")
32 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 |
|---|---|---|
| Bangla | mT5-small | 82.69 |
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}