This model is a fine-tuned version of
openai/whisper-medium on 10 hours of in-domain Kreol Morisien (Mauritian Creole) audio data, with accent conditioning.
1from transformers import WhisperProcessor, WhisperForConditionalGeneration
2import soundfile as sf
3
4processor = WhisperProcessor.from_pretrained("Shagufta/whisper-medium-km-indomain10-withac")
5model = WhisperForConditionalGeneration.from_pretrained("Shagufta/whisper-medium-km-indomain10-withac")
6
7speech, sr = sf.read("audio.wav", dtype="float32")
8
9input_features = processor.feature_extractor(
10 speech, sampling_rate=16000, return_tensors="pt"
11).input_features
12
13predicted_ids = model.generate(
14 input_features,
15 max_length=256,
16 num_beams=5,
17)
18
19transcription = processor.tokenizer.batch_decode(predicted_ids, skip_special_tokens=True)[0]
20print(transcription)
1model.config.forced_decoder_ids = None
2model.config.suppress_tokens = []