Kintu-ASR-1.0

Hugging Face language license params base test WER test CER format format format

A tiny (~8.2M parameters) speech recognition model for Luganda. It is the encoder of Whisper-tiny fine-tuned with one linear layer on top that predicts a letter for every 20 ms of audio (CTC). There is no decoder, so every letter of the output is tied to a moment in the audio: the model cannot write sentences that were not said.

It comes in three formats: safetensors (PyTorch), ONNX (fp32, q4, and int8) and GGUF (f16, Q8_0, and q4_0).

Usage

The model code lives in henryhale/kintu-asr. The weights are downloaded from this repository on first use.

pip install "kintu-asr[onnx,gguf] @ git+https://github.com/henryhale/kintu-asr.git"
from kintu_asr.inference import Transcriber

asr = Transcriber("henryhale/Kintu-ASR-1.0")                    # PyTorch, model.safetensors
# asr = Transcriber("henryhale/Kintu-ASR-1.0", backend="onnx")  # onnx/model_int8.onnx
# asr = Transcriber("henryhale/Kintu-ASR-1.0", backend="gguf")  # gguf/model-q8_0.gguf
print(asr.transcribe("clip.wav"))

Any audio format librosa reads works, at any length: long files are read in overlapping 30 s windows. Pick another file with onnx_file="onnx/model_q4.onnx" or gguf_file="gguf/model-q4_0.gguf".

From the command line:

git clone https://github.com/henryhale/kintu-asr.git && cd kintu-asr
pip install -e ".[onnx,gguf]"
python scripts/transcribe.py --backend onnx clip.wav

In the browser, with nothing to install: henryhale.github.io/kintu-asr.

Input and output

  • Audio: 16 kHz mono, up to 30 s per call (longer audio is cut at 30 s; split it first).
  • Output: lowercase Luganda letters, digits, apostrophes and spaces. ng' is written as ŋ. No punctuation or capitals.
  • Alphabet (29 symbols + CTC blank): 'abcdefghijklmnoprstuvwxyzŋᵑ

Training

Base model openai/whisper-tiny encoder (4 layers, 384 dims)
Head one linear layer over the alphabet, CTC loss
Data 20 h sampled from the train split of google/WaxalNLP (lug_asr); 5% held out for validation and 5% for test
Steps 2500 at batch 64
Optimizer AdamW (weight decay 0.01), learning rate 1e-4 for the encoder and 1e-3 for the head, 250 warmup steps, cosine decay
Other SpecAugment, fp16 mixed precision, input convolutions frozen, best checkpoint by validation WER (38.8%)
Hardware Kaggle, 2× NVIDIA T4

Text normalization (applied to training targets and to references when scoring): Unicode NFC, lowercase, all apostrophe variants turned into ', ng' turned into ŋ, all other punctuation turned into spaces.

Quantization

How far each export is from the fp32 PyTorch model, on the same audio:

Format Max |logit difference| vs PyTorch fp32 Same best symbol per frame
PyTorch fp32 (safetensors) 0.00e+00 100.00%
ONNX fp32 8.39e-04 100.00%
ONNX int8 1.53e+01 96.89%
ONNX q4 1.50e+01 96.21%
GGUF f16 7.40e-02 100.00%
GGUF q8_0 2.42e+00 99.85%
GGUF q4_0 1.62e+01 95.54%

Limitations

  • Greedy decoding with no language model. Most remaining errors are spelling: words run together as spoken (vowel elision), doubled vowels, l/r. A Luganda n-gram language model with beam search would likely lower WER.
  • The held-out test clips come from the same recordings pool as the training clips, so speakers may overlap and that number may be optimistic. The official-split results above do not have this problem.
  • The transcripts in the dataset are not consistent about apostrophes (y'obudde / yobudde), which counts against WER.
  • At most 30 s per call, no punctuation or capitals, no timestamps exposed (although each letter is tied to a 20 ms frame).

Acknowledgements

License

The model weights are released under CC-BY-SA-4.0, following the license of the Luganda data in google/WaxalNLP (Makerere University, CC-BY-SA-4.0). The base model openai/whisper-tiny is Apache-2.0.

Downloads last month
199
Safetensors
Model size
8.22M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for henryhale/Kintu-ASR-1.0

Quantized
(265)
this model

Dataset used to train henryhale/Kintu-ASR-1.0

Collection including henryhale/Kintu-ASR-1.0

Evaluation results