Add sample usage section and improve paper link in model card

#1
by nielsr HF Staff - opened
Files changed (1) hide show
  1. README.md +39 -1
README.md CHANGED
@@ -12,7 +12,45 @@ tags:
12
 
13
  <!-- Provide a quick summary of what the model is/does. -->
14
 
15
- Lite-Whisper is a compressed version of OpenAI Whisper with LiteASR. See our [GitHub repository](https://github.com/efeslab/LiteASR) and [paper](https://arxiv.org/abs/2502.20583) for details.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  ## Benchmark Results
18
 
 
12
 
13
  <!-- Provide a quick summary of what the model is/does. -->
14
 
15
+ Lite-Whisper is a compressed version of OpenAI Whisper with LiteASR, as described in the paper [LiteASR: Efficient Automatic Speech Recognition with Low-Rank Approximation](https://huggingface.co/papers/2502.20583). See our [GitHub repository](https://github.com/efeslab/LiteASR) for more details.
16
+
17
+ ## Usage
18
+
19
+ The easiest way to run our model is to use our integration with HuggingFace Transformers library. We provide model weights for the compressed version of OpenAI Whisper series [here](https://huggingface.co/efficient-speech).
20
+
21
+ ```python
22
+ import librosa
23
+ import torch
24
+ from transformers import AutoProcessor, AutoModel
25
+
26
+ device = "cuda:0"
27
+ dtype = torch.float16
28
+
29
+ # load the compressed Whisper model
30
+ model = AutoModel.from_pretrained(
31
+ "efficient-speech/lite-whisper-large-v3-turbo",
32
+ trust_remote_code=True,
33
+ )
34
+ model.to(dtype).to(device)
35
+
36
+ # we use the same processor as the original model
37
+ processor = AutoProcessor.from_pretrained("openai/whisper-large-v3")
38
+
39
+ # set the path to your audio file
40
+ path = "path/to/audio.wav"
41
+ audio, _ = librosa.load(path, sr=16000)
42
+
43
+ input_features = processor(audio, sampling_rate=16000, return_tensors="pt").input_features
44
+ input_features = input_features.to(dtype).to(device)
45
+
46
+ predicted_ids = model.generate(input_features)
47
+ transcription = processor.batch_decode(
48
+ predicted_ids,
49
+ skip_special_tokens=True
50
+ )[0]
51
+
52
+ print(transcription)
53
+ ```
54
 
55
  ## Benchmark Results
56