PEFT
Joblib
Safetensors
Swahili
English
afrolingo-2
kenya
swahili
sheng
swaenglish
asr
tts
voice-cloning
dialect-classification
fastapi
Instructions to use MRM5/AfroLingo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use MRM5/AfroLingo with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
|
Download README.md from MRM5/AfroLingo: direct link, hf CLI and curl.
- Browser
- Download file 3.01 kB
-
https://huggingface.co/MRM5/AfroLingo/resolve/main/README.md
- Command line
-
hf download hf://MRM5/AfroLingo/README.md
-
curl -L -o README.md https://huggingface.co/MRM5/AfroLingo/resolve/main/README.md
3.01 kB
| language: | |
| - sw | |
| - en | |
| library_name: peft | |
| base_model: openai/whisper-small | |
| tags: | |
| - afrolingo-2 | |
| - kenya | |
| - swahili | |
| - sheng | |
| - swaenglish | |
| - asr | |
| - tts | |
| - voice-cloning | |
| - dialect-classification | |
| - fastapi | |
| license: apache-2.0 | |
| # AfroLingo-2 Master: Kenyan Speech Intelligence Suite & FastAPI Backend SDK | |
| AfroLingo-2 is a multi-task East African Speech Intelligence platform fine-tuned and benchmarked on 3,509 real Kenyan field recordings across Isiolo, Kilifi, Kitale (Trans-Nzoia), Nakuru, and Nairobi. | |
| ## Master Benchmark Summary (OpenAI Whisper vs. Meta MMS vs. AfroLingo-2) | |
| | Feature Module | OpenAI Whisper-Small | Meta MMS Suite | AfroLingo-2 Master | | |
| | :--- | :--- | :--- | :--- | | |
| | 1. Speech-to-Text (Kenyan ASR) | 98.86% WER (85% loops) | 66.99% WER (0% loops) | 45.33% WER / 27.13% CER (0% loops) | | |
| | 2. County Geo-Localization | Not Supported | Not Supported | 96.88% Held-Out Test Accuracy (5 Counties) | | |
| | 3. Text-to-Speech (Female & Male) | Not Supported | 72.4% Intelligibility | 86.2% Intelligibility (sw-KE Female/Male + Lexicon) | | |
| | 4. Zero-Shot Custom Voice Cloning | Not Supported | Fixed Single Voice | 99.5% Cosine Sim / 2.83 Hz F0 Err / 14.48 dB MCD | | |
| | 5. Sheng -> Kiswahili Sanifu | Hallucinates | Phoneticizes Only | Morphological Normalizer + Sanifu TTS | | |
| | 6. Isochronous Neural Dubbing | Text Only | Unaligned Duration | 0.000s Lip-Sync Drift ([0:00 - 0:06]) | | |
| | 7. Emotion & Voice Tones | Not Supported | Monotone Only | 4 Calibrated Tones (Passionate, Conversational, Formal, Calm) | | |
| | 8. Multi-Speaker Diarization | Single Stream | Single Stream | Turn-by-Turn VAD + Pitch/MFCC Clustering | | |
| ## FastAPI Backend Integration Guide | |
| Backend developers can mount all endpoints into an existing FastAPI application via `sdk/fastapi_afrolingo2_router.py` or call individual features slowly using `sdk/afrolingo2_engine.py`: | |
| from fastapi import FastAPI | |
| from sdk.fastapi_afrolingo2_router import router as afrolingo2_router | |
| app = FastAPI() | |
| app.include_router(afrolingo2_router) # Exposes /api/v1/afrolingo2/* | |
| ### Calling Individual Features in Python: | |
| from sdk.afrolingo2_engine import AfroLingo2Engine | |
| engine = AfroLingo2Engine('MRM5/AfroLingo') | |
| # 1. Generate Speech from Text (Female vs. Male) | |
| female_res = engine.generate_speech('Karibu Qhala!', out_path='female.wav', gender='female') | |
| male_res = engine.generate_speech('Karibu Qhala!', out_path='male.wav', gender='male') | |
| # 2. Clone a Custom Voice from Any Speaker Recording | |
| cloned = engine.clone_custom_voice( | |
| text='Hii ni sauti yangu iliyoigwa na AfroLingo-2.', | |
| reference_audio_path='speaker_sample.wav', | |
| out_path='cloned_speaker.wav' | |
| ) | |
| # 3. Normalize Sheng/Swaenglish -> Kiswahili Sanifu | |
| norm = engine.normalize_sheng_to_sanifu('Manze uka-decide ku-buy simu ya kabambe', synthesize_audio=True, out_audio_path='sanifu.wav') | |
| # 4. Predict Kenyan County from Audio (96.88% Accuracy) | |
| county = engine.predict_county('field_recording.wav') |