Yoruba speech to english text speech to text translation task.
# Yoruba → English Speech Translation
Fine-tunes OpenAI Whisper (`small`) to translate spoken Yoruba audio into English text. The encoder is updated while the decoder is frozen, making this an efficient transfer-learning setup.
---
## Requirements
```bash
pip install torch transformers datasets librosa numpy pandas tqdm nltk huggingface_hub
```
A CUDA-capable GPU is strongly recommended. The script automatically falls back to CPU but training will be very slow without a GPU.
---
## Data Format
### Audio
Pre-extracted audio arrays stored as `.npy` files (float32, mono, 16 kHz).
Expected directory layout:
```
yoruba/
train/audio/ ← .npy files, e.g. Y_001_0001.npy
dev/audio/ ← .npy files
```
File naming convention: `Y_ _ .npy`
The script maps each Yoruba file to its English counterpart using the ID scheme `E _ `.
### Labels (CSV)
Two CSV files with at minimum these two columns:
| column | description |
|----------|-------------------------------------|
| `text_id`| Unique utterance ID, e.g. `E01_0001`|
| `text` | English translation string |
```
english_text/
train/eng_text_train.csv
dev/eng_text_dev.csv
```
---
## Usage
### Basic (all defaults)
```bash
python train.py
```
### Custom paths and hyperparameters
```bash
python train.py \
--model_id openai/whisper-medium.en \
--train_audio_dir yoruba/train/audio/ \
--train_csv english_text/train/eng_text_train.csv \
--dev_audio_dir yoruba/dev/audio/ \
--dev_csv english_text/dev/eng_text_dev.csv \
--output_dir s2tt_models \
--epochs 5 \
--train_batch_size 16 \
--eval_batch_size 16 \
--learning_rate 1e-3 \
--warmup_steps 500 \
--weight_decay 0.001
```
### All CLI arguments
| Argument | Default | Description |
|---------------------|--------------------------------------|------------------------------------------|
| `--model_id` | `openai/whispe …