Views
No views yet
pipeline
class to transcribe audios of arbitrary length, inluding local audio files:1import torch
2from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
3device = "cuda:0" if torch.cuda.is_available() else "cpu"
4torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
5model_id = "leophill/whisper-large-v3-turbo-sw-kinyarwanda"
6model = AutoModelForSpeechSeq2Seq.from_pretrained(
7 model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True
8)
9model.to(device)
10processor = AutoProcessor.from_pretrained(model_id)
11pipe = pipeline(
12 "automatic-speech-recognition",
13 model=model,
14 tokenizer=processor.tokenizer,
15 feature_extractor=processor.feature_extractor,
16 torch_dtype=torch_dtype,
17 device=device,
18)
19audio_file = "audio.wav"
20result = pipe(audio_file, generate_kwargs={"language": "swahili", "task": "transcribe"})
21print(result["text"])1@misc{whisper_lv3_turbo_kinyarwanda_asr,
2 author = {Leopold Hillah},
3 title = {Finetuning Whisper Large V3 Turbo for Kinyarwanda ASR using Swahili as Proxy Language},
4 year = {2025},
5 publisher = {Hugging Face},
6 url = {https://huggingface.co/leophill/whisper-large-v3-turbo-sw-kinyarwanda}
7}
8@misc{kinyarwanda-automatic-speech-recognition-track-a,
9 author = {Digital Umuganda},
10 title = {Kinyarwanda Automatic Speech Recognition Track A},
11 year = {2025},
12 howpublished = {\url{https://kaggle.com/competitions/kinyarwanda-automatic-speech-recognition-track-a}},
13 note = {Kaggle}
14}