This is a version of
openai/whisper-large-v3 model without number tokens (token ids corresponding to numbers are excluded).
NO fine-tuning was used.
Phrases with spoken numbers will be transcribed with numbers as words. It can be useful for TTS data preparation.
1>>> from transformers import WhisperProcessor, WhisperForConditionalGeneration
2>>> import torchaudio
3
4>>> # load audio
5>>> wav, sr = torchaudio.load("audio.wav")
6>>> # resample if necessary
7>>> wav = torchaudio.functional.resample(wav, sr, 16000)
8
9>>> # load model and processor
10>>> processor = WhisperProcessor.from_pretrained("waveletdeboshir/whisper-large-v3-no-numbers")
11>>> model = WhisperForConditionalGeneration.from_pretrained("waveletdeboshir/whisper-large-v3-no-numbers")
12
13>>> input_features = processor(wav[0], sampling_rate=16000, return_tensors="pt").input_features
14
15>>> # generate token ids
16>>> predicted_ids = model.generate(input_features)
17>>> # decode token ids to text
18>>> transcription = processor.batch_decode(predicted_ids, skip_special_tokens=False)
19['<|startoftranscript|><|en|><|transcribe|><|notimestamps|> Twenty seven years. <|endoftext|>']
20
The context tokens can be removed from the start of the transcription by setting skip_special_tokens=True.