AfriSpeech audio paired with IPA phoneme transcriptions for 141 African languages, and the CTC phoneme recogniser trained on it
# afrispeech-ipa-trainer
Code that builds AfriSpeech/african-speech-ipa
— AfriSpeech audio paired with IPA phoneme transcriptions for 141 African languages,
2,265 hours — and fine-tunes a CTC phoneme recogniser on it.
The model transcribes speech to phonemes rather than words, so it works for languages with
no spelling standard, and its output feeds forced alignment and TTS.
Most people want the dataset, not this repo:
```python
from datasets import load_dataset
ds = load_dataset("AfriSpeech/african-speech-ipa", "yoruba_yor", split="train")
ds[0]["ipa"] # 't ɛ˥ ŋ i˩ k ã b ä˥ ŋ˥ ʃ ä˩ i˩ s ä˩ ŋ …'
```
This repo is for rebuilding it, changing how it is built, or training on it.
Despite the name, roughly half of what is here builds the corpus rather than trains on
it — donor mapping, ingestion, verification, the phoneme inventory and publishing all
live in `pipeline/`. Training is `training/`.
## Layout
| path | what it does |
|---|---|
| `src/afrispeech_ipa/donor_map.py` | decides which africa-g2p rule set phonemises each language |
| `src/afrispeech_ipa/english_subset.py` | selects the Common Voice English subset |
| `pipeline/modal_app.py` | builds and publishes the corpus on Modal |
| `pipeline/modal_app.py::rephonemise` | recomputes targets after a rules change, without re-fetching audio |
| `pipeline/modal_train.py` | training on Modal (separate file so a GPU the account cannot provision does not fail the data stages) |
| `training/build_corpus.py` | published dataset → omniASR training layout |
| `training/prepare.py` | tokenizer, sampling weights, asset cards |
| `training/train.sh`, `ctc-africa-ipa.yaml` | the fine-tune |
| `training/early_stop.py` | UER watchdog; fairseq2's recipe has no patience setting |
| `data/language_map.json` | the rule set, tier and measured coverage for every language |
## Choosing a rule set per language
africa-g2p has rules for 400 languages, but not for every language in AfriSpeech. Each is
assigned to one of three ti …