Downloads · 30 days
86
25% of all-time downloads
keystats/w2v-bert-2.0-lang-id-lug-sna-lin-best
w2v-bert-2.0-lang-id-lug-sna-lin-best is a audio classification model from keystats. Use it for the audio classification task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
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. This…
Downloads · 30 days
86
25% of all-time downloads
All-time downloads
344
Public
Parameters
581M
2.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.3 GB · 100%
From the Hugging Face model README
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. This is an improved variant of
keystats/w2v-bert-2.0-lang-id-lug-sna-lin
— see Difference from the base LID model
below.
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. Like the base LID model,
this model does not transcribe speech — it only outputs a language
label.
The base w2v-bert-2.0-lang-id-lug-sna-lin
model was trained on WAXAL data only. This -best variant adds
additional community-sourced audio datasets for each language on
top of the WAXAL training pool, specifically to push the model beyond
WAXAL's own acoustic conditions — the goal being a classifier that
generalizes to audio drawn from outside the WAXAL distribution, not
just data that looks like WAXAL.
| Source | Role |
|---|---|
| google/WaxalNLP — Luganda, Shona, Lingala configs | train splits from all three language configs pooled into training (each clip labeled with its language); validation splits pooled together and held out for monitoring |
| Additional community-sourced audio datasets (per language) | Pooled into training alongside WAXAL, to broaden acoustic/speaker coverage beyond WAXAL alone |
Only WAXAL's own validation/test splits were used for evaluation
— the added community data was used for training only.
facebook/w2v-bert-2.0Wav2Vec2BertForSequenceClassification (audio
classification head over the pretrained encoder), 3 output classes
(Luganda, Shona, Lingala)This model scored ~99.9% accuracy on both the WAXAL validation and test splits — effectively perfect, with only 1–2 misclassified clips out of the full evaluation sets (the exact count varied by a couple of clips between validation and test).
Note: this is marginally lower than the base LID model's 100% on WAXAL's own splits, which is expected — training on a broader mix of data (beyond WAXAL alone) trades a hair of in-domain accuracy for better generalization to audio outside WAXAL's specific recording conditions. As always, treat these in-domain WAXAL numbers as an upper bound rather than a guarantee of out-of-domain performance, though the added training data here is specifically meant to narrow that gap.
import torch
import librosa
from transformers import Wav2Vec2BertForSequenceClassification, Wav2Vec2BertProcessor
MODEL_ID = "keystats/w2v-bert-2.0-lang-id-lug-sna-lin-best"
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"
-main-best checkpoints in this collection).If you use this model, please cite the training/fine-tuning work and the underlying dataset:
@misc{keystats_wav2vec2bert_langid_lug_sna_lin_best,
title={w2v-bert-2.0-lang-id-lug-sna-lin-best: A Luganda/Shona/Lingala spoken language identification model fine-tuned from facebook/w2v-bert-2.0 with additional data for generalization},
author={keystats},
year={2026},
howpublished={\url{https://huggingface.co/keystats/w2v-bert-2.0-lang-id-lug-sna-lin-best}}
}
@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}}
}