AI-Enabled Kiswahili Speech-to-Text System for Education
# Kiswahili Speech-to-Text System for Education
A lightweight deep learning system that converts spoken Kiswahili into text,
designed to run on low-cost hardware (Android/Raspberry Pi) for use in
Kenyan classrooms.
## Project Structure
```
kiswahili-stt/
├── data/
│ ├── raw/ # Downloaded datasets (not committed to Git)
│ ├── processed/ # Cleaned and resampled audio
│ └── splits/ # Train/validation/test splits
├── notebooks/ # Jupyter notebooks for exploration and training
├── src/
│ ├── data/ # Data loading and preprocessing scripts
│ ├── model/ # Model loading and fine-tuning scripts
│ ├── evaluate/ # Evaluation and metrics scripts
│ └── app/ # Gradio demo application
├── models/
│ ├── checkpoints/ # Training checkpoints (not committed to Git)
│ └── quantised/ # Optimised models for edge deployment
├── results/ # Evaluation results and metrics logs
└── requirements.txt
```
## Setup
```bash
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```
## Training Workflow
1. Download and preprocess data:
```bash
python src/data/download_datasets.py
python src/data/preprocess.py
python src/data/prepare_splits.py
```
2. Run baseline evaluation:
```bash
python src/evaluate/baseline_evaluation.py
```
3. Fine-tune Whisper on Kiswahili:
```bash
python src/model/finetune_whisper.py \
--model-name openai/whisper-small \
--output-dir models/checkpoints/whisper-small-sw-ft \
--learning-rate 1e-5 \
--epochs 10
```
4. Evaluate fine-tuned checkpoint on test set:
```bash
python src/evaluate/finetuned_evaluation.py \
--checkpoint models/checkpoints/whisper-small-sw-ft \
--output results/finetuned_results.json
```
## Fine-Tune With More Data
To increase training data, build an augmented train split by adding cleaned Common Voice Swahili clips to your current FLEURS train split:
```bash
python src/data/prepare_augmented_train.py \
--base-splits-dir data/splits \
--common …