This model is a fine-tuned version of
openai/whisper-medium on the Common Voice 11.0 dataset, and the Romanian speech synthesis corpus.
It achieves the following results on the evaluation set:
The architecture is the same as
openai/whisper-medium.
1from transformers import WhisperProcessor, WhisperForConditionalGeneration
2from datasets import Audio, load_dataset
3import torch
4
5# load model and processor
6processor = WhisperProcessor.from_pretrained("gigant/whisper-medium-romanian")
7model = WhisperForConditionalGeneration.from_pretrained("gigant/whisper-medium-romanian")
8
9# load dummy dataset and read soundfiles
10ds = load_dataset("common_voice", "ro", split="test", streaming=True)
11ds = ds.cast_column("audio", Audio(sampling_rate=16_000))
12input_speech = next(iter(ds))["audio"]["array"]
13model.config.forced_decoder_ids = processor.get_decoder_prompt_ids(language = "ro", task = "transcribe")
14input_features = processor(input_speech, return_tensors="pt", sampling_rate=16_000).input_features
15predicted_ids = model.generate(input_features, max_length=448)
16# transcription = processor.batch_decode(predicted_ids)
17transcription = processor.batch_decode(predicted_ids, skip_special_tokens = True)
The code was adapted from
openai/whisper-medium.