Downloads · 30 days
5
3% of all-time downloads
olaverse/lid-neural-5.1
lid-neural-5.1 is a text classification model from olaverse. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
Downloads · 30 days
5
3% of all-time downloads
All-time downloads
151
Public
Parameters
30.9M
123 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors123 MB · 97%
From the Hugging Face model README

A compact language identifier for the four main Nigerian languages — Hausa (hau),
Yoruba (yor), Igbo (ibo), and Nigerian Pidgin (pcm) — built as a classification head
on olaverse/mist-encoder-base-ng.
It is trained on sentence-level text, so it works on short inputs (tweets, queries, single sentences), not just long documents. At ~31M parameters it runs comfortably on CPU / edge.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
tok = AutoTokenizer.from_pretrained("olaverse/lid-neural-5.1")
model = AutoModelForSequenceClassification.from_pretrained("olaverse/lid-neural-5.1")
text = "Ina kwana?"
inputs = tok(text, return_tensors="pt", truncation=True, max_length=128)
with torch.no_grad():
probs = model(**inputs).logits.softmax(-1)[0]
pred = model.config.id2label[int(probs.argmax())]
print(pred, float(probs.max())) # -> Hausa 0.99
Labels: Hausa, Yoruba, Igbo, Nigerian Pidgin (see id2label in the config).
Held-out test set (sentence-level), balanced across the four languages.
| Metric | Score |
|---|---|
| Accuracy | 0.9756 |
| Macro-F1 | 0.9753 |
Confusion matrix (rows = true, cols = predicted):
| hau | yor | ibo | pcm | |
|---|---|---|---|---|
| hau | 815 | 2 | 1 | 12 |
| yor | 2 | 755 | 3 | 20 |
| ibo | 2 | 4 | 819 | 8 |
| pcm | 11 | 10 | 3 | 733 |
Hausa, Yoruba, and Igbo are separated near-perfectly (1–4 cross-errors each). Almost all residual confusion involves Nigerian Pidgin, which is English-lexified and shares surface vocabulary with the others — so it is the hardest class and the main source of error.
Sentence-level text drawn from our own monolingual corpora — each language's text is its own label, so no separate labelled dataset was needed. Sources: FineWeb-2 (ODC-By) for ha/yo/ig/pcm and the Nigerian Pidgin ASR corpus (CC-BY-4.0) for additional Pidgin. All attribution-only, consistent with the Apache-2.0 release.
Apache-2.0. Training data is attribution-only (ODC-By / CC-BY-4.0); please retain attribution to the upstream corpora.