Instructions to use temp-anon/openlid-v3-sinhala-script-lid-target-only with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- fastText
How to use temp-anon/openlid-v3-sinhala-script-lid-target-only with fastText:
from huggingface_hub import hf_hub_download import fasttext model = fasttext.load_model(hf_hub_download("temp-anon/openlid-v3-sinhala-script-lid-target-only", "model.bin")) - Notebooks
- Google Colab
- Kaggle
OpenLID-v3: Sinhala-script LID (target-only)
OpenLID-v3 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
HPLT/OpenLID-v3 (revision 6b9560483e17e42f48d86cebf22b4b58dffeaa70). This checkpoint inherits the base model's licence (gpl-3.0).
Training and selection
| Regime | target_only |
| Seed | 42 |
| Selected lr | 0.2 (grid [0.02, 0.05, 0.2]) |
| Selected epoch | 3 of max 3 |
| Selection metric | macro_target3 on validation = 0.9977 |
| 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.9995 [0.9991, 0.9997] | 0.9996 [0.9994, 0.9998] | 0.9996 [0.9994, 0.9998] | n/a |
| FLORES+ hybrid | 27078 | 0.9983 [0.9978, 0.9987] | 0.9976 [0.9968, 0.9983] | 0.9996 [0.9994, 0.9999] | 0.9968 [0.9957, 0.9978] |
| CommonLID hybrid | 89874 | 0.9003 [0.8983, 0.9023] | 0.9482 [0.9456, 0.9507] | 0.9734 [0.9719, 0.9749] | 0.9388 [0.9352, 0.9421] |
| WiLI-2018 hybrid | 22469 | 0.9930 [0.9920, 0.9940] | 0.9800 [0.9768, 0.9832] | 0.9994 [0.9991, 0.9997] | 0.9717 [0.9671, 0.9763] |
Usage
import fasttext
from huggingface_hub import hf_hub_download
model = fasttext.load_model(hf_hub_download("temp-anon/openlid-v3-sinhala-script-lid-target-only", "model.bin"))
labels, probs = model.predict("නමෝ තස්ස භගවතෝ අරහතෝ සම්මාසම්බුද්ධස්ස")
print(labels[0].removeprefix("__label__"), float(probs[0])) # e.g. pli_Sinh
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("openlid_v3", snapshot_download("temp-anon/openlid-v3-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/openlid-v3-sinhala-script-lid-target-only
Base model
HPLT/OpenLID-v3