WavLM Base Plus for Nigerian Language Identification
A fine-tuned microsoft/wavlm-base-plus model that identifies which Nigerian language is spoken in a short speech clip. It was built by a team of four at the DSN AI Bootcamp 2026 hackathon (Nigerian Language Identification Challenge).
Languages
The model predicts 13 classes:
| Code | Language |
|---|---|
| yor | Yoruba |
| ibo | Igbo |
| hau | Hausa |
| ego | Ego |
| anw | Anaang |
| efi | Efik |
| ibb | Ibibio |
| idu | Idoma |
| igl | Igala |
| nup | Nupe |
| tiv | Tiv |
| urh | Urhobo |
| other | Other |
Results
Evaluated on the held-out validation split (4,378 clips):
| Metric | Score |
|---|---|
| Macro F1 (raw) | 0.5907 |
| Macro F1 (after per-class bias calibration) | 0.6242 |
| Weighted F1 (raw) | 0.7568 |
The calibration offsets were tuned on the same validation set they are reported on, so the calibrated score is optimistic. The raw macro F1 of 0.59 is the more honest headline number. The calibration is already applied to the classifier bias in the saved weights.
How to use
import numpy as np, torch, librosa
from transformers import AutoFeatureExtractor, AutoModelForAudioClassification
model_id = "AbdulroqeebA/wavlm-base-plus-nigerian-lid"
extractor = AutoFeatureExtractor.from_pretrained(model_id)
model = AutoModelForAudioClassification.from_pretrained(model_id).float().eval()
audio, _ = librosa.load("clip.wav", sr=16000, mono=True)
MAX_LEN = 16000 * 10 # clips are cropped or padded to 10 seconds
if len(audio) > MAX_LEN:
start = (len(audio) - MAX_LEN) // 2
audio = audio[start:start + MAX_LEN]
inputs = extractor(audio, sampling_rate=16000, max_length=MAX_LEN,
truncation=True, padding="max_length", return_tensors="pt")
with torch.no_grad():
probs = torch.softmax(model(**inputs).logits[0], dim=-1)
top = probs.topk(3)
for p, i in zip(top.values, top.indices):
print(model.config.id2label[int(i)], round(float(p), 3))
Training details
- Data:
Data-Science-Nigeria/dsn-2026-lid-train(16 kHz audio, clips cropped or padded to 10 s). 24,748 training clips and 4,378 validation clips. Because Nupe had very few examples, 26 of its training clips were moved to validation so every class is represented there. - Base model: WavLM Base Plus (about 94.6M parameters).
- Imbalance handling: dampened class weights (power 0.5).
- Augmentation: pitch shift, noise, gain, and a low-pass filter to mimic phone audio and reduce speaker memorization.
- Training: up to 4 epochs, FP16, gradient accumulation, early stopping on macro F1.
- Calibration: per-class bias offsets tuned on validation logits to raise macro F1.
Limitations
- This is a baseline, not a production system. A macro F1 of about 0.59 means many clips are misclassified, and performance varies a lot between languages. For example, Yoruba clips are sometimes confused with Idoma.
- It was trained on one dataset, so recordings from phones, noisy rooms, or compressed apps may perform worse.
- Only the 13 listed classes are supported, and speech in any other language is forced into one of them or into "other".
- Short clips (under about 2 seconds) are less reliable.
- Do not use it to make decisions about people.
Credits and licenses
- Team (equal contribution, built together at the DSN AI Bootcamp 2026 hackathon): Olawale Anthony Arowolo, Nnaluo Onyeka Collins, Abdulwahab Abdulroqeeb Opeyemi, and Moshood Abdulganiyu.
- Based on the team's original hackathon notebook. This version was retrained, packaged, and published by the team under this repository.
- Base model: Microsoft WavLM Base Plus.
- Dataset: Data Science Nigeria's
dsn-2026-lid-train, whose audio has mixed per-source licenses. See the dataset page for the terms.