Swahili TTS
# Swahili TTS Fine-tuning for Cloud GPU
This repository contains the necessary code and configuration to fine-tune the `facebook/mms-tts-swh` model using the Mozilla Common Voice Swahili dataset on a cloud GPU environment (e.g., Google Colab, AWS SageMaker, GCP AI Platform, Kaggle Kernel).
It is adapted from the ylacombe/finetune-hf-vits repository.
## Prerequisites
* Cloud environment with a CUDA-enabled GPU (e.g., NVIDIA T4, V100, A100).
* Python 3.8+
* Git
* Hugging Face account and authentication token (Settings -> Access Tokens).
* (Optional) Weights & Biases account for experiment tracking (wandb.ai).
## Setup
1. **Clone the repository:**
```bash
git clone
cd swahili-tts-cloud-gpu
```
2. **Create a Python virtual environment (Recommended):**
```bash
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
```
3. **Install requirements:**
```bash
pip install -r requirements.txt
# Verify torch is installed with CUDA support
# python -c "import torch; print(torch.cuda.is_available())"
```
4. **Build Monotonic Alignment Search:**
This requires C build tools (e.g., `build-essential` on Debian/Ubuntu).
```bash
cd monotonic_align
python setup.py build_ext --inplace
cd ..
```
5. **Log in to Hugging Face:**
```bash
huggingface-cli login
# Enter your token with write permissions
```
6. **(Optional) Log in to Weights & Biases:**
```bash
wandb login
# Enter your API key
```
## Fine-tuning Process
1. **Prepare the Base Model:**
Convert the original MMS checkpoint to include the discriminator. This saves the required model files into the `./models/base_model` directory.
```bash
python convert_original_discriminator_checkpoint.py --language_code sw --pytorch_dump_folder_path ./models/base_model
```
*(Note: The language code here is `sw`, consistent with the dataset config name).*
2. **Accept Dataset Terms:**
You *must* have accepted the terms for the `mozilla-foundation/common_voice_17_0` dataset on the Hugging Fa …