Moonshine-Tiny Nigerian Accented English (Speech-to-Text)
This repository provides fine-tuned weights, extended dialect vocabulary, and evaluation benchmarks for UsefulSensors/moonshine-tiny (~27M parameters) adapted to Nigerian Accented English (en).
Fine-tuned on authentic speech recordings from the benjaminogbonna/nigerian_accented_english_dataset corpus on an NVIDIA A10G GPU over 3,000 optimization steps.
Model Specifications
| Attribute | Specification |
|---|---|
| Base Architecture | UsefulSensors Moonshine (Encoder-Decoder Transformer) |
| Base Checkpoint | UsefulSensors/moonshine-tiny (~27M parameters) |
| Target Language | Nigerian Accented English (en) |
| Audio Format | 16,000 Hz, 16-bit Mono PCM |
| Training Steps | 3,000 optimization steps (Cosine Decay, AdamW) |
| Hardware | NVIDIA A10G (24 GB VRAM) |
| Precision | Float16 / BFloat16 Mixed Precision |
| Real-Time Factor (RTF) | 0.051x (~19.6x faster than real-time) |
Benchmark Results (Held-Out Test Set)
Evaluated across held-out test audio recordings using standard Whisper/ASR text normalization (lowercasing, punctuation stripping, whitespace normalization):
| Metric | Score |
|---|---|
| Normalized Word Error Rate (WER) | 65.2% |
| Normalized Character Error Rate (CER) | 55.8% |
| Real-Time Factor (RTF) | 0.051x |
| Processing Speed | < 200ms per 4-second audio |
Qualitative Inspection on Held-Out Samples
Below is a side-by-side comparison between the ground-truth audio and the Moonshine transcription:
Sample 1 (5.5s)
- Ground Truth:
Indentured service in Igbo areas was described by Olaudah Equiano in his memoir. - Moonshine Output:
In the ancient service in Igbo areas was described by Olawda Ekwano in his memoir.
Sample 2 (3.2s)
- Ground Truth:
Future purchases will require fingerprint instead of password - Moonshine Output:
Future purchases will require fingerprints instead of password.
Sample 3 (4.5s)
- Ground Truth:
The flag was introduced and hoisted in public at the Indonesian Declaration of Independence - Moonshine Output:
The flag was introduced and oystered in public at the Indonesian Declaration of Independence.
Quickstart & Inference
import torch
import librosa
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
from transformers.models.whisper.english_normalizer import BasicTextNormalizer
repo_id = "samuelolubukun/moonshine-tiny-nigerian-accented-english"
device = "cuda" if torch.cuda.is_available() else "cpu"
# 1. Load Model & Processor
processor = AutoProcessor.from_pretrained(repo_id)
model = AutoModelForSpeechSeq2Seq.from_pretrained(
repo_id,
torch_dtype=torch.float16 if device == "cuda" else torch.float32
).to(device).eval()
# 2. Load and Resample Audio (16,000 Hz mono)
wav, sr = librosa.load("audio_sample.wav", sr=16000)
inputs = processor([wav], sampling_rate=16000, return_tensors="pt")
input_values = inputs.get("input_values", inputs.get("input_features")).to(device, dtype=model.dtype)
# 3. Dynamic Token Budget (~7 tokens per second of speech)
dur = len(wav) / sr
safe_tokens = min(90, max(25, int(dur * 7)))
with torch.inference_mode():
pred_ids = model.generate(
input_values=input_values,
max_new_tokens=safe_tokens,
repetition_penalty=1.1,
num_beams=2,
)
transcription = processor.batch_decode(pred_ids, skip_special_tokens=True)[0].strip()
print(f"Transcription: {transcription}")
# 4. Optional Text Normalization
normalizer = BasicTextNormalizer()
print(f"Normalized: {normalizer(transcription)}")
Limitations & Edge Usage
- Ultra-Compact Architecture: At ~27M parameters, this model is designed for ultra-low latency, mobile devices, and real-time voice agents. For complex long-form multi-speaker broadcast audio, larger models (Whisper Medium/Large) provide greater vocabulary capacity.
- Audio Cleanliness: The model performs best on clean near-field speech (telephony, headset, or smartphone voice notes) sampled at 16 kHz.
Author & Attribution
Fine-tuned and benchmarked by Samuel Olubukun:
- Website: samuelolubukun.com
- GitHub: @samolubukun
- Hugging Face: @samuelolubukun
Dataset Attribution
Trained using data from benjaminogbonna/nigerian_accented_english_dataset. We express our sincere gratitude to the dataset curators for making speech corpora accessible for African language research.