waveletdeboshir commited on
Commit
261e132
1 Parent(s): 0a192f7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -0
README.md CHANGED
@@ -29,6 +29,31 @@ Model size is 30% less then original whisper-base:
29
  | model file size | 290 Mb | 203 Mb |
30
  | vocab_size | 51865 | 4705 |
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  ## Other pruned whisper models
33
  * [waveletdeboshir/whisper-tiny-ru-pruned](https://huggingface.co/waveletdeboshir/whisper-tiny-ru-pruned)
34
  * [waveletdeboshir/whisper-small-ru-pruned](https://huggingface.co/waveletdeboshir/whisper-small-ru-pruned)
 
29
  | model file size | 290 Mb | 203 Mb |
30
  | vocab_size | 51865 | 4705 |
31
 
32
+ ## Usage
33
+ Model can be used as an original whisper:
34
+
35
+ ```python
36
+ >>> from transformers import WhisperProcessor, WhisperForConditionalGeneration
37
+ >>> import torchaudio
38
+
39
+ >>> # load audio
40
+ >>> wav, sr = torchaudio.load("audio.wav")
41
+
42
+ >>> # load model and processor
43
+ >>> processor = WhisperProcessor.from_pretrained("waveletdeboshir/whisper-base-ru-pruned")
44
+ >>> model = WhisperForConditionalGeneration.from_pretrained("waveletdeboshir/whisper-base-ru-pruned")
45
+
46
+ >>> input_features = processor(wav[0], sampling_rate=sr, return_tensors="pt").input_features
47
+
48
+ >>> # generate token ids
49
+ >>> predicted_ids = model.generate(input_features)
50
+ >>> # decode token ids to text
51
+ >>> transcription = processor.batch_decode(predicted_ids, skip_special_tokens=False)
52
+ ['<|startoftranscript|><|ru|><|transcribe|><|notimestamps|> Начинаем работу.<|endoftext|>']
53
+
54
+ ```
55
+ The context tokens can be removed from the start of the transcription by setting `skip_special_tokens=True`.
56
+
57
  ## Other pruned whisper models
58
  * [waveletdeboshir/whisper-tiny-ru-pruned](https://huggingface.co/waveletdeboshir/whisper-tiny-ru-pruned)
59
  * [waveletdeboshir/whisper-small-ru-pruned](https://huggingface.co/waveletdeboshir/whisper-small-ru-pruned)