Logo Lanfrica

DEFI-COLaF/Speech-Recognition-for-Low-Resource-Languages

Domain:

natural language processing

Record type:

software
Creator:
DEF
Host:
# Speech-Recognition-for-Low-Resource-Languages This repository contains code to fine-tune Whisper models on custom datasets. It includes: * `fine_tune_whisper.py`: The core script for fine-tuning, data preprocessing, training, and saving models. * `fine_tuning_example.py`: An example script demonstrating how to use `fine_tune_whisper.py` for fine-tuning. * `basque_fine_tuning.py`: An example script for fine-tuning Whisper on a Basque dataset and evaluating the model performance. ### 📦 Requirements Install dependencies with: `pip install -r requirements.txt` ### ⚙️ Configuration Update the following parameters at the top of `fine_tuning_example.py` to configure data paths, model selection, and training settings: ```python # Save directory for checkpoints SAVE_DIR = "./SAVE_DIR" # Whisper model variant (options: "openai/whisper-base", "openai/whisper-medium", "openai/whisper-large", "openai/whisper-large-v3") MODEL_NAME = "openai/whisper-medium" # Target language (must match dataset and be supported by Whisper) LANGUAGE = "Basque" # Training parameters BATCH_SIZE = 24 # batch size per GPU MAX_EPOCHS = 30 # total training epochs ACCUMULATE_GRAD_BATCHES = 24 # gradient accumulation steps LEARNING_RATE = 1e-4 # optimizer learning rate ``` Whisper supports a fixed set of languages. You can find the full list of supported languages here. If your language is not included, select the closest supported one (e.g., you can use Swahili for Shimaore and German for Alsatian). Otherwise, you may omit the `LANGUAGE` parameter to enable automatic detection. Adjust `BATCH_SIZE` and `ACCUMULATE_GRAD_BATCHES` depending on your available GPU memory. Choose a `BATCH_SIZE` that balances memory usage with training stability. If you encounter memory limitations, reduce the batch size and use `ACCUMULATE_GRAD_BATCHES` to accumulate gradients over multiple steps, allowing you to simulate a larger effective batch size while avoiding memor …