Results (YECS test, 9,905 utterances)
Scored against the plain-fine-tuned control with identical normalization. Language tags
are stripped from both reference and hypothesis before computing WER/CER, so the
transcription comparison is apples-to-apples; the tags are scored separately as LID.
Table with columns: Metric, Tag-injection (this model), Plain baseline| Metric | Tag-injection (this model) | Plain baseline |
|---|
| WER — tone-aware | 16.81% | 16.73% |
| WER — tone-insensitive | 14.04% | 13.86% |
| CER — tone-aware | 6.25% | 6.38% |
| CER — tone-insensitive | 5.02% | 5.10% |
| Per-word LID — accuracy | 99.54% | — |
| Per-word LID — macro-F1 | 99.54% | — |
Adding inline tags matches the plain model's WER (within run-to-run noise; CER is
actually a touch better) while delivering 99.54% per-word language identification for
free. For reference, the reported whisper-small-yoruba baseline is 20.76% WER; this
project's plain 5-epoch fine-tune reaches 16.73%.
The same result holds across three architectures
The tag-vs-plain A/B was run identically on three model families:
Table with columns: Model, WER tone-aware (plain → tag), Per-word LID (tag)| Model | WER tone-aware (plain → tag) | Per-word LID (tag) |
|---|
| Omnilingual CTC 300M | 33.57 → 32.45 | 98.04% |
| Omnilingual LLM 1.63B | 16.15 → 16.29 | 99.55% |
| Whisper-small (this) | 16.73 → 16.81 | 99.54% |
Inline language-tag injection costs ~nothing on WER (−1.1 to +0.1 absolute) and gives
98–99.5% free per-word LID on CTC, LLM, and Whisper alike.
How it was built
- Target serialization — each transcript's per-word
language_tags are grouped
into contiguous same-language spans and wrapped: <yo> … </yo> <en> … </en>.
- Tokenizer — the four tags are added with
add_tokens(..., special_tokens=False)
so they are ordinary vocabulary items that survive decode(skip_special_tokens=True)
(unlike control tokens, which would be dropped). Embeddings are resized to match.
- Fine-tune — standard
Seq2SeqTrainer, language conditioning yoruba,
task transcribe.
Normalization (how WER/CER are computed)
NFC → lowercase → strip Unicode punctuation/symbol categories (P/S). Two variants:
- tone-aware keeps Yoruba tone diacritics (acute/grave/macron), so getting a word's
tone wrong counts as an error — the stricter, fuller score.
- tone-insensitive additionally strips the three tonal combining marks, isolating
word/segment accuracy. The phonemic under-dot (ọ, ẹ, ṣ) is a distinct letter and is
always kept in both variants.
The gap between the two measures how well the model handles Yoruba tone marking.
Usage
from transformers import WhisperForConditionalGeneration, WhisperProcessor
import torch, librosa
repo = "LyngualLabs/yecs-asr-whisper-lid"
proc = WhisperProcessor.from_pretrained(repo)
model = WhisperForConditionalGeneration.from_pretrained(repo, torch_dtype=torch.bfloat16).to("cuda").eval()
audio, _ = librosa.load("utterance.wav", sr=16000)
feats = proc.feature_extractor(audio, sampling_rate=16000, return_tensors="pt").input_features
ids = model.generate(feats.to("cuda", torch.bfloat16),
language="yoruba", task="transcribe", max_new_tokens=225)
print(proc.tokenizer.batch_decode(ids, skip_special_tokens=True)[0])
Strip the tags for a plain transcript, or parse the spans to recover per-word language.
Training
- Base:
openai/whisper-small · 5 epochs · lr 1e-5 · bf16 · effective batch 32 · 1×H200.
- Language conditioning
yoruba, task transcribe; forced_decoder_ids=None,
suppress_tokens=[]; best checkpoint by dev WER.
- Data: YECS train (80,013 utts / ~95.6 h), 16 kHz mono; dev for checkpoint selection.
- Logged to Weights & Biases (
afroscale_ai_cmu_africa/yecs-lid, run whisper-tag).
Intended use & limitations
Research on Yoruba–English code-switching ASR and per-word spoken language identification.
- Trained on YECS read/prompted speech; far-field, noisy, or spontaneous conversational
audio may degrade.
- LID is scored on words the model recognizes (aligned ref/hyp words); it is not a
standalone LID system for arbitrary audio.
- Two languages only (
yo, en); other languages are out of scope.
License
Apache-2.0 (inherited from openai/whisper-small). YECS corpus terms apply to the
training data.