# EGRA-Swahili
To run EGRA tasks, you need to specify the model, dataset, and split name. The `subtask` argument can be one of `syllable`, `word`, `letter`, `pseudo_word`, `sentence`, or `phoneme`. At the moment, we support wav2vec2-CTC models that are integrated with the Hugging Face transformers library.
## Datasets on π€ Hub
The dataset is available on the Hugging Face Datasets Hub (with private access):
- Swahili EGRA Kids
```sh
model=bookbot/wav2vec2-xls-r-300m-swahili-cv-fleurs-alffa-alphabets-phonemes-bookbot
split=test
for subtask in syllable letter phoneme pseudo_word word sentence; do
python src/egra_inference.py \
--model_name $model \
--dataset_name bookbot/bookbot_swahili_egra_kids \
--split_name $split \
--subtask $subtask \
--use_substitution_pairs
done
```
## Local Datasets
To run the code locally, you need to prepare a directory with the following structure:
Directory Structure
```
bookbot_swahili_egra_kids/
βββ letter
β βββ a.txt
β βββ a.wav
β βββ ...
βββ phoneme
β βββ Ι.txt
β βββ Ι.wav
β βββ ...
βββ pseudo_word
| βββ adoseti.txt
| βββ adoseti.wav
| βββ ...
βββ sentence
β βββ sentence1.txt
β βββ sentence1.wav
β βββ ...
βββ syllable
β βββ kwa.txt
β βββ kwa.wav
β βββ ...
βββ word
βββ mbali.txt
βββ mbali.wav
βββ ...
```
where each subdirectory is a subtask, and each audio `.wav` file has a corresponding phoneme transcript `.txt` file. The audio files should be in the WAV format, and will be resampled to 16kHz. The transcripts should contain the phoneme labels for the corresponding audio files. The phoneme labels should be in the format of a single line with space-separated phonemes (e.g. `n i p Ι k Ι m k u Ι w Ι`). We use phoneme vocabulary from the gruut phonemizer. For a full list of the vocab, please see here.
Then to run the code locally, you can use the following command:
```sh
model=bookbot/wav2vec2-xls-r-300m-swahili-cv-fleurs-alffa-alphabets-phonemes-bookbot
for subtask in syllable letter phoneme ps β¦