Instructions to use samwell/dondo-nano-twi-ewe with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use samwell/dondo-nano-twi-ewe with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="samwell/dondo-nano-twi-ewe")# Load model directly from transformers import AutoProcessor, AutoModelForCTC processor = AutoProcessor.from_pretrained("samwell/dondo-nano-twi-ewe") model = AutoModelForCTC.from_pretrained("samwell/dondo-nano-twi-ewe", device_map="auto") - Notebooks
- Google Colab
- Kaggle
DONDO-nanos: on-device ASR for Twi and Ewe
Compressed, on-device-friendly versions of Khaya AI's DONDO speech model for Twi and Ewe. The default model in this repo is Nano-L12 (315.6M params). Smaller variants and an int8 ONNX build are in subfolders.
The recipe is depth reduction with a warm start: a shallower Wav2Vec2-BERT student is initialized from evenly-spaced layers of the 24-layer parent (plus its feature projection, adapter, and CTC head), then fine-tuned on WAXAL Twi and Ewe. Knowledge distillation from the parent was tested and dropped, because the parent is out-of-domain on WAXAL and its soft targets made the student worse.
Results
Blended error = 0.5·WER + 0.5·CER on WAXAL validation (Twi/Ewe mean), greedy CTC decode, normalized text. All rows below are trained on the same WAXAL data (CTC, no distillation).
| Model | Layers | Params | Disk (fp32) | CPU RTF | Blended |
|---|---|---|---|---|---|
| Fine-tuned parent | 24 | 605.8M | 2423 MB | 0.252 | 0.216 |
| Nano-L12 (default) | 12 | 315.6M | 1262 MB | 0.132 | 0.261 |
Nano-L6 (nano-l6/) |
6 | 170.5M | 682 MB | 0.069 | 0.387 |
Nano-L3 (nano-l3/) |
3 | 98.0M | 392 MB | 0.036 | ~0.57 |
Halving the model (606M to 316M) costs 0.045 blended error. Nano-L12 also beats a zero-shot Meta MMS-1b (~965M, ~0.37 on these clips), though that comparison favors the nano, which saw in-domain data.
int8 (onnx/): ONNX Runtime dynamic int8 shrinks Nano-L12 from 1262 MB to 319 MB (~4x) for
almost no accuracy change (0.266 to 0.269 in the same runtime). It does not speed up inference on
CPU, since the model is already faster than real time; the win is size.
Usage
from transformers import AutoProcessor, AutoModelForCTC
import torch, librosa
proc = AutoProcessor.from_pretrained("samwell/dondo-nano-twi-ewe") # Nano-L12
model = AutoModelForCTC.from_pretrained("samwell/dondo-nano-twi-ewe").eval()
# smaller variants: subfolder="nano-l6" or "nano-l3"
y, _ = librosa.load("clip.wav", sr=16000)
feats = proc(y, sampling_rate=16000, return_tensors="pt").input_features
with torch.no_grad():
ids = model(feats).logits.argmax(-1)
print(proc.batch_decode(ids)[0])
Limitations
- Evaluated on WAXAL validation only; no on-device (ARM) latency numbers yet.
- Trained on ~6k clips; more data would likely close the Nano-L12 to parent gap (0.261 vs 0.216).
- Twi and Ewe only, from a parent that also covers other Ghanaian languages.
Attribution
- Base model: KhayaAI/w2v-bert-ada_ewe_fat_fra_gaa_nzi_twi_en (Apache-2.0)
- Training data: google/WaxalNLP (CC-BY-SA-4.0 / CC-BY-4.0)
Released under CC-BY-SA-4.0 to respect the share-alike terms of the WAXAL training data.
- Downloads last month
- 38