Instructions to use temp-anon/xlmr-langid-sinhala-script-lid-target-only with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use temp-anon/xlmr-langid-sinhala-script-lid-target-only with PEFT:
from peft import PeftModel from transformers import AutoModelForSequenceClassification base_model = AutoModelForSequenceClassification.from_pretrained("papluca/xlm-roberta-base-language-detection") model = PeftModel.from_pretrained(base_model, "temp-anon/xlmr-langid-sinhala-script-lid-target-only") - Notebooks
- Google Colab
- Kaggle
XLM-R (papluca language detection): Sinhala-script LID (target-only)
XLM-R (papluca language detection) fine-tuned to separate Sinhala, Pali and Sanskrit written in Sinhala
script (sin_Sinh, pli_Sinh, san_Sinh), which the base model labels as Sinhala.
Training regime: target-only adaptation (Sinhala, Pali and Sanskrit training data only). The model keeps the base model's original output
labels; labels it lacked were added.
Code: https://anonymous.4open.science/r/Sinhala-LangID/
Base model
papluca/xlm-roberta-base-language-detection (revision 9865598389ca9d95637462f743f683b51d75b87b). This checkpoint inherits the base model's licence (mit).
Training and selection
| Regime | target_only |
| Seed | 42 |
| Selected lr | 0.0001 (grid [2e-05, 5e-05, 0.0001]) |
| Selected epoch | 3 of max 3 |
| Selection metric | macro_target3 on validation = 0.9975 |
| Training / validation rows | 151979 / 18999 |
| Rule | max validation metric; ties keep the first found: smaller lr, then earlier epoch |
The full grid is in training/selection_log.csv.
Evaluation
Scored labels: target sin_Sinh, pli_Sinh, san_Sinh; replay san_Deva, eng_Latn, tam_Taml, hin_Deva, ben_Beng, arb_Arab, fra_Latn, deu_Latn.
Hybrid sets use each benchmark's own rows for the replay labels, with its
Sinhala-script rows replaced by the target test split. Predictions are
unrestricted. Values are point estimates with bootstrap 95% CIs.
| Eval set | n | Accuracy | Macro-F1 (11) | Macro-F1 (target 3) | Macro-F1 (replay 8) |
|---|---|---|---|---|---|
| Target test (Sinhala/Pali/Sanskrit) | 18982 | 0.9996 [0.9992, 0.9998] | 0.9996 [0.9992, 0.9999] | 0.9996 [0.9992, 0.9999] | n/a |
| FLORES+ hybrid | 27078 | 0.7595 [0.7543, 0.7645] | 0.4043 [0.4014, 0.4066] | 0.9021 [0.8980, 0.9056] | 0.2176 [0.2141, 0.2205] |
| CommonLID hybrid | 89874 | 0.3654 [0.3623, 0.3685] | 0.3043 [0.3023, 0.3063] | 0.6465 [0.6408, 0.6524] | 0.1760 [0.1743, 0.1776] |
| WiLI-2018 hybrid | 22469 | 0.8742 [0.8696, 0.8784] | 0.4419 [0.4374, 0.4466] | 0.9548 [0.9524, 0.9570] | 0.2221 [0.2159, 0.2288] |
Usage
With the code release (any model family), using the same loader as the paper's evaluation:
from huggingface_hub import snapshot_download
from lidpipe.models import load # data_pipeline/ in the code repository
model = load("xlmr", snapshot_download("temp-anon/xlmr-langid-sinhala-script-lid-target-only"))
labels, confidences = model.predict(["නමෝ තස්ස භගවතෝ අරහතෝ සම්මාසම්බුද්ධස්ස"])
Inputs should be normalised as in the paper (lidpipe.text.normalise: NFC, invisible
characters removed except ZWJ/ZWNJ, whitespace collapsed).
Citation
@misc{sinhala_script_lid,
title = {A Benchmark for Sinhala-Script Language Identification: Sinhala, Pali, and Sanskrit},
author = {Anonymous},
year = {2026}
}
- Downloads last month
- -
Model tree for temp-anon/xlmr-langid-sinhala-script-lid-target-only
Base model
FacebookAI/xlm-roberta-base