Bofeng Huang
commited on
Update README
Browse files
README.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
```python
|
| 2 |
from datasets import load_dataset
|
| 3 |
from huggingface_hub import hf_hub_download
|
|
@@ -11,4 +39,58 @@ sample = dataset[0]["audio"]["path"]
|
|
| 11 |
|
| 12 |
result = model.transcribe(sample, language="en")
|
| 13 |
print(result["text"])
|
| 14 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
tags:
|
| 5 |
+
- audio
|
| 6 |
+
- automatic-speech-recognition
|
| 7 |
+
license: mit
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Distil-Whisper: Distil-Large-v3.5 for OpenAI Whisper
|
| 11 |
+
|
| 12 |
+
This repository contains the model weights for [distil-large-v3.5](https://huggingface.co/distil-whisper/distil-large-v3.5)
|
| 13 |
+
converted to [OpenAI Whisper](https://github.com/openai/whisper) format.
|
| 14 |
+
|
| 15 |
+
## Python Usage
|
| 16 |
+
|
| 17 |
+
To use the model in the original Whisper format, first ensure you have the [`openai-whisper`](https://pypi.org/project/openai-whisper/) package installed.
|
| 18 |
+
|
| 19 |
+
For this example, we'll also install 🤗 Datasets to load a toy audio dataset from the Hugging Face Hub:
|
| 20 |
+
|
| 21 |
+
```bash
|
| 22 |
+
pip install --upgrade pip
|
| 23 |
+
pip install --upgrade openai-whisper datasets[audio]
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
The following code-snippet demonstrates how to transcribe a sample file from the LibriSpeech dataset loaded using
|
| 27 |
+
🤗 Datasets:
|
| 28 |
+
|
| 29 |
```python
|
| 30 |
from datasets import load_dataset
|
| 31 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 39 |
|
| 40 |
result = model.transcribe(sample, language="en")
|
| 41 |
print(result["text"])
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
Note that the model weights will be downloaded and saved to your cache the first time you run the example. Subsequently,
|
| 45 |
+
you can re-use the same example, and the weights will be loaded directly from your cache without having to download them
|
| 46 |
+
again.
|
| 47 |
+
|
| 48 |
+
To transcribe a local audio file, simply pass the path to the audio file as the `audio` argument to transcribe:
|
| 49 |
+
|
| 50 |
+
```python
|
| 51 |
+
result = model.transcribe(model, audio="audio.mp3", language="en")
|
| 52 |
+
print(result["text"])
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
## CLI Usage
|
| 56 |
+
|
| 57 |
+
The Distil-Whisper model can also be used with the OpenAI Whisper CLI. First, pip install the Hugging Face Hub package:
|
| 58 |
+
|
| 59 |
+
```bash
|
| 60 |
+
pip install --upgrade huggingface_hub
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
Next, download the weights for distil-large-v3 locally:
|
| 64 |
+
|
| 65 |
+
```bash
|
| 66 |
+
huggingface-cli download distil-whisper/distil-large-v3.5-openai model.bin --local-dir distil-large-v3.5
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
Finally, use the OpenAI Whisper CLI to transcribe:
|
| 70 |
+
|
| 71 |
+
```bash
|
| 72 |
+
whisper audio.mp3 --model distil-large-v3.5/model.bin --language en
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
## Model Details
|
| 77 |
+
|
| 78 |
+
For more information about the Distil-Large-v3.5 model, refer to the original [model card](https://huggingface.co/distil-whisper/distil-large-v3.5).
|
| 79 |
+
|
| 80 |
+
## License
|
| 81 |
+
|
| 82 |
+
Distil-Whisper inherits the [MIT license](https://github.com/huggingface/distil-whisper/blob/main/LICENSE) from OpenAI's Whisper model.
|
| 83 |
+
|
| 84 |
+
## Citation
|
| 85 |
+
|
| 86 |
+
If you use this model, please consider citing the [Distil-Whisper paper](https://arxiv.org/abs/2311.00430):
|
| 87 |
+
```
|
| 88 |
+
@misc{gandhi2023distilwhisper,
|
| 89 |
+
title={Distil-Whisper: Robust Knowledge Distillation via Large-Scale Pseudo Labelling},
|
| 90 |
+
author={Sanchit Gandhi and Patrick von Platen and Alexander M. Rush},
|
| 91 |
+
year={2023},
|
| 92 |
+
eprint={2311.00430},
|
| 93 |
+
archivePrefix={arXiv},
|
| 94 |
+
primaryClass={cs.CL}
|
| 95 |
+
}
|
| 96 |
+
```
|