Views
No views yet
kohomada instead of කොහොමද. This model converts that Romanized input back into proper Sinhala Unicode script — including the messy, inconsistent, real-world typing patterns that standard phonetic models struggle with.kohomda, kohomadha, kohmda) is notoriously hard. This model was built to handle it. Training proceeded in three phases:| Metric | Phonetic | Ad-hoc |
|---|---|---|
| CER | 0.0182 | 0.0416 |
| WER | 0.0931 | 0.1587 |
| Exact Acc | 0.37 | 0.205 |
| BLEU-4 Word | 0.7757 | 0.6666 |
| BLEU-4 Char | 0.9569 | 0.9225 |
| BERTScore F1 | 0.986 | 0.9706 |
1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4model_id = "savinugunarathna/Gemma3-Singlish-Sinhala-Merged"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype=torch.bfloat16,
10 device_map="auto"
11)
12
13def transliterate(singlish_text: str) -> str:
14 prompt = f"Transliterate the following Romanized Sinhala to Sinhala script:\n{singlish_text}\nSinhala:"
15 inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
16 with torch.no_grad():
17 outputs = model.generate(**inputs, max_new_tokens=128)
18 decoded = tokenizer.decode(outputs[0], skip_special_tokens=True)
19 return decoded.split("Sinhala:")[-1].strip()
20
21# Works on clean phonetic input
22print(transliterate("kohomada")) # → කොහොමද
23
24# Also handles messy ad-hoc input
25print(transliterate("kohomda")) # → කොහොමද
26print(transliterate("mama giye")) # → මම ගියේ1@misc{gunarathna2025gemma3singlish,
2 title={Gemma3-Singlish-Sinhala-Merged: A Three-Phase Fine-Tuned Model for Romanized Sinhala Transliteration},
3 author={Gunarathna, Savinu},
4 year={2025},
5 howpublished={\url{https://huggingface.co/savinugunarathna/Gemma3-Singlish-Sinhala-Merged}},
6 note={Indo NLP Shared Task submission}
7}1@article{sumanathilaka2025swa,
2 title={Swa-bhasha Resource Hub: Romanized Sinhala to Sinhala Transliteration Systems and Data Resources},
3 author={Sumanathilaka, Deshan and Perera, Sameera and Dharmasiri, Sachithya and Athukorala, Maneesha and Herath, Anuja Dilrukshi and Dias, Rukshan and Gamage, Pasindu and Weerasinghe, Ruvan and Priyadarshana, YHPP},
4 journal={arXiv preprint arXiv:2507.09245},
5 year={2025}
6}
7
8@article{ranasinghe2022sold,
9 title={SOLD: Sinhala Offensive Language Dataset},
10 author={Ranasinghe, Tharindu and Anuradha, Isuri and Premasiri, Damith and Silva, Kanishka and Hettiarachchi, Hansi and Uyangodage, Lasitha and Zampieri, Marcos},
11 journal={arXiv preprint arXiv:2212.00851},
12 year={2022}
13}
14
15@inproceedings{Nsina2024,
16 author={Hettiarachchi, Hansi and Premasiri, Damith and Uyangodage, Lasitha and Ranasinghe, Tharindu},
17 title={{NSINA: A News Corpus for Sinhala}},
18 booktitle={The 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024)},
19 year={2024},
20 month={May},
21}