Views
No views yet
swa_tts configuration of the google/WaxalNLP dataset.whisper-small base model and fine-tunes it specifically on Swahili speech-text pairs to improve transcription accuracy for the Swahili language.openai/whisper-smallsw)transcribetransformers (Seq2SeqTrainer)evaluate library's wer metric, with basic text normalization (lowercasing, punctuation stripping, whitespace collapsing) applied to both predictions and references before scoring.EVAL_SPLIT_FRACTION > 0) for a more reliable evaluation.1from transformers import WhisperProcessor, WhisperForConditionalGeneration
2import librosa
3
4model_id = "mnigr/whisper-swa-tts-finetuned"
5
6processor = WhisperProcessor.from_pretrained(model_id)
7model = WhisperForConditionalGeneration.from_pretrained(model_id)
8
9# Load and resample audio to 16kHz mono
10waveform, sr = librosa.load("path/to/audio.wav", sr=16000)
11
12inputs = processor(waveform, sampling_rate=16000, return_tensors="pt")
13
14forced_decoder_ids = processor.get_decoder_prompt_ids(language="sw", task="transcribe")
15predicted_ids = model.generate(
16 inputs.input_features,
17 forced_decoder_ids=forced_decoder_ids,
18 max_new_tokens=225,
19)
20
21transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
22print(transcription)transformersdatasetsaccelerate1@misc{radford2022whisper,
2 title={Robust Speech Recognition via Large-Scale Weak Supervision},
3 author={Radford, Alec and Kim, Jong Wook and Xu, Tao and Brockman, Greg and McLeavey, Christine and Sutskever, Ilya},
4 year={2022},
5 eprint={2212.04356},
6 archivePrefix={arXiv}
7}