w2v-bert-2.0-lang-id-lug-sna-lin
A spoken language identification (LID) model that classifies short audio clips into one of three languages — Luganda, Shona, or Lingala — fine-tuned from facebook/w2v-bert-2.0 with a sequence classification head, trained on the WAXAL corpus only.
Model description
facebook/w2v-bert-2.0 — a large-scale, multilingual self-supervised
speech encoder pretrained with a BERT-style masked prediction
objective — is used as the backbone, with a from-scratch audio
classification head fine-tuned to predict which of the three
languages a given audio clip is spoken in. Unlike the companion ASR
models in this collection, this model does not transcribe speech — it
only outputs a language label.
Training data
| Source | Role |
|---|---|
| google/WaxalNLP — Luganda, Shona, Lingala configs | train splits from all three language configs pooled together (each clip labeled with its language) for training; validation splits pooled together and held out for monitoring |
Only WAXAL data was used — no additional community datasets were pooled in.
Training procedure
- Base model:
facebook/w2v-bert-2.0 - Architecture:
Wav2Vec2BertForSequenceClassification(audio classification head over the pretrained encoder), 3 output classes (Luganda, Shona, Lingala) - Sample rate: 16 kHz mono
- Hardware: single RTX PRO 6000
Evaluation results
This model achieved perfect accuracy (100%) on both the validation and test splits, correctly classifying every clip across all three languages.
Note: Perfect accuracy on a 3-way language ID task like this is plausible — Luganda, Shona, and Lingala are phonologically quite distinct from each other, which makes the classification task much easier than, say, distinguishing closely related dialects. As always, treat in-domain WAXAL numbers as an upper bound rather than a guarantee of real-world performance on out-of-domain audio.
How to use
import torch
import librosa
from transformers import Wav2Vec2BertForSequenceClassification, Wav2Vec2BertProcessor
MODEL_ID = "keystats/w2v-bert-2.0-lang-id-lug-sna-lin"
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
processor = Wav2Vec2BertProcessor.from_pretrained(MODEL_ID)
model = Wav2Vec2BertForSequenceClassification.from_pretrained(MODEL_ID).to(DEVICE).eval()
audio_array, sr = librosa.load("path/to/audio.wav", sr=16000, mono=True)
inputs = processor(audio_array, sampling_rate=16000, return_tensors="pt")
with torch.no_grad():
logits = model(input_features=inputs.input_features.to(DEVICE)).logits
predicted_id = torch.argmax(logits, dim=-1).item()
predicted_label = model.config.id2label[predicted_id]
print(predicted_label) # "luganda", "shona", or "lingala"
Intended uses & limitations
- Intended for identifying which of Luganda, Shona, or Lingala is
being spoken in a given audio clip — useful as a pre-processing
step to route audio to the correct language-specific ASR model
(e.g. the Luganda
-main-bestcheckpoints in this collection). - This is a closed-set 3-way classifier: it will always output one of the three trained languages, even for audio in a different language or non-speech audio. It has no "none of the above" / out-of-domain detection.
- Trained and evaluated only on WAXAL data — perfect validation/test accuracy reflects in-domain WAXAL audio conditions and may not carry over as-is to audio from very different recording conditions, speakers, or dialectal variation.
- Not a general-purpose language ID model — it only distinguishes between these three specific languages, not the full range of African languages or languages generally.
Citation
If you use this model, please cite the training/fine-tuning work and the underlying dataset:
@misc{keystats_wav2vec2bert_langid_lug_sna_lin,
title={w2v-bert-2.0-lang-id-lug-sna-lin: A Luganda/Shona/Lingala spoken language identification model fine-tuned from facebook/w2v-bert-2.0},
author={keystats},
year={2026},
howpublished={\url{https://huggingface.co/keystats/w2v-bert-2.0-lang-id-lug-sna-lin}}
}
@misc{waxal,
title={WAXAL: A Multilingual African Speech Dataset},
author={Google},
howpublished={\url{https://huggingface.co/datasets/google/WaxalNLP}}
}
@inproceedings{w2vbert2,
title={Seamless: Multilingual Expressive and Streaming Speech Translation},
author={Seamless Communication and others},
year={2023},
howpublished={\url{https://huggingface.co/facebook/w2v-bert-2.0}}
}