Instructions to use Pricile/afrivoices-edge-asr with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Pricile/afrivoices-edge-asr with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="Pricile/afrivoices-edge-asr")# Load model directly from transformers import AutoProcessor, AutoModelForCTC processor = AutoProcessor.from_pretrained("Pricile/afrivoices-edge-asr") model = AutoModelForCTC.from_pretrained("Pricile/afrivoices-edge-asr", device_map="auto") - Notebooks
- Google Colab
- Kaggle
wbertcur — Unified Edge ASR for Six East African Languages
A single, edge-deployable speech-to-text model for six East African languages, built for the AfriVoices East Africa ASR Hackathon (Multilingual Edge ASR track).
| Languages | Swahili (swa), Kikuyu (kik), Dholuo (luo), Kalenjin (kln), Maasai (mas), Somali (som) |
| Backbone | facebook/w2v-bert-2.0 (Conformer, 580 M params, MIT) |
| Head | character-level CTC |
| Weights | included in this repo (checkpoint wbertcur-step-16500) |
| Decoder | per-language 4-gram KenLM (shallow fusion, pyctcdecode, beam 100) |
| License | MIT |
Edge compliance (validated)
| Requirement | Limit | Measured | Status |
|---|---|---|---|
| Parameters | < 1 B | 0.58 B | ✅ |
| Peak RAM | ≤ 8 GB | 5.53 GB (single language, int8) | ✅ |
| Compute | CPU only | CPU only | ✅ |
| Latency (RTF) | ≤ 2.0 | 0.091 (int8, KenLM beam 100, end-to-end) | ✅ |
See HARDWARE_VALIDATION_REPORT.md in this repo for the full methodology.
Results
| Configuration | Dev macro-WER | Kaggle (public) |
|---|---|---|
| Greedy (no LM) | 0.3547 | — |
| + web-augmented 4-gram KenLM + per-language α/β | 0.2866 | 0.37236 |
Metric = unweighted mean of per-language WER (macro).
Usage
import numpy as np, torch, pyctcdecode, soundfile as sf
from transformers import Wav2Vec2BertForCTC, Wav2Vec2BertProcessor
REPO = "Pricile/afrivoices-edge-asr" # self-contained: weights + LMs in this repo
model = Wav2Vec2BertForCTC.from_pretrained(REPO).eval()
proc = Wav2Vec2BertProcessor.from_pretrained(REPO)
# character vocabulary sorted by index (required by pyctcdecode)
vocab = [t for t, i in sorted(proc.tokenizer.get_vocab().items(), key=lambda x: x[1])]
# per-language 4-gram KenLM binaries are in this repo under lm/ (huggingface_hub.hf_hub_download)
decoder = pyctcdecode.build_ctcdecoder(vocab, kenlm_model_path="lm/som_final_4gram.binary",
alpha=0.5, beta=2.0) # per-language α/β (see code/ab.json)
audio, sr = sf.read("clip.wav") # 16 kHz mono
feats = proc.feature_extractor(audio, sampling_rate=16000, return_tensors="pt").input_features
with torch.no_grad():
logits = model(feats).logits[0].numpy()
print(decoder.decode(logits, beam_width=100))
For CPU edge deployment, apply dynamic int8 quantisation:
torch.quantization.quantize_dynamic(model, {torch.nn.Linear}, dtype=torch.qint8, inplace=True)
Training (summary)
Fine-tuned from scratch on top of w2v-bert-2.0 with a character-level CTC head, using a
length curriculum (max audio 15 s → 30 s → 45 s → 60 s) and language re-weighting
(kln×4, mas×4, som×2) since the macro metric is dominated by the low-resource languages.
LR 5e-5, cosine schedule, effective batch 32, bf16, EMA (0.9999), seed 42; best at step 16 500.
Full methodology and ablations in TECHNICAL_REPORT.md.
Dataset & data card
Trained on AfriVoices-KE (African Next Voices — Pilot Data Collection in Kenya), released by
the KenCorpus Consortium (Maseno University, USIU-Africa, Kabarak University, DeKUT, LDRI) and
Digital Umuganda, funded by the Gates Foundation. License: CC BY 4.0. The organisers'
full data card is reproduced in DATA_CARD.md.
- Competition: AfriVoices East Africa: ASR Hackathon (Kaggle · host: Digital Umuganda)
- Test set:
digitalumuganda/anv-test-data-nt· Training sources:Anv-ke(kik/luo/kln/mas/som),DigitalUmuganda/Afrivoice_Swahili,DigitalUmuganda/Afrivoice(Somali Mogadishu)
Composition (organisers' figures):
| Language | ISO | Dialects | Scripted (h) | Unscripted (h) | Total (h) |
|---|---|---|---|---|---|
| Swahili | swa | Nairobi/Kisii/Wajir/Mombasa/Nakuru, Tanzania | 0 | 2 979 | 2 979 |
| Kikuyu | kik | GÄ©-Kabete, Ki-Mathira, Ki-Muranga, Ki-Ndia, GÄ©-Gichugu | 183 | 571 | 754 |
| Dholuo | luo | Nyandwat, Milambo | 195 | 528 | 723 |
| Somali | som | Maxatire, Mogadishu | 118 | 884 | 1 002 |
| Kalenjin | kln | Nandi, Kipsigis | 122 | 399 | 521 |
| Maasai | mas | Kimasaai, Kisamburu | 51 | 454 | 505 |
Splits are speaker-disjoint (train 85 % / dev 5 % / dev_test 5 % / test 5 %). For LM shallow fusion, extra public text was used for Somali (CC-100) and Kalenjin (Zenodo).
Please cite the dataset (Wanzare et al., 2026 — accepted at LREC SIGUL 2026):
AfriVoices-KE: A Multilingual Speech Dataset for Kenyan Languages, arXiv:2604.08448.
Limitations
- Kalenjin and Maasai remain the hardest languages (genuine low-resource acoustic difficulty).
- The KenLM decoder is per-language; language identity is assumed known at inference (or run LID first).
- Trained and evaluated on the AfriVoices-KE distribution (read + spontaneous speech).
License & citation
MIT. Backbone w2v-bert-2.0 is likewise MIT. Please cite the AfriVoices Hackathon and this repository.
- Downloads last month
- 42