sanchit-gandhi
commited on
Commit
·
9d28567
1
Parent(s):
9cf7d4e
Update README.md
Browse files
README.md
CHANGED
@@ -36,10 +36,10 @@ models: **6.3x faster than large-v3**, and 1.1x faster than distil-large-v2.
|
|
36 |
| [distil-large-v2](https://huggingface.co/distil-whisper/distil-large-v2) | 756 | 5.8 | 9.6 | 15.6 | 11.6 |
|
37 |
|
38 |
Since the sequential algorithm is the "de-facto" transcription algorithm across the most popular Whisper libraries
|
39 |
-
(Whisper cpp, Faster-Whisper, OpenAI Whisper), this distilled model is designed to be compatible
|
40 |
-
|
41 |
-
when using these
|
42 |
-
with instructions for getting started
|
43 |
|
44 |
## Table of Contents
|
45 |
|
@@ -60,7 +60,7 @@ with instructions for getting started [here](#library-integrations).
|
|
60 |
|
61 |
## Transformers Usage
|
62 |
|
63 |
-
distil-large-v3 is supported in the Hugging Face 🤗 Transformers library from version 4.
|
64 |
install the latest version of Transformers. For this example, we'll also install 🤗 Datasets to load a toy audio dataset
|
65 |
from the Hugging Face Hub:
|
66 |
|
@@ -261,10 +261,10 @@ inputs = inputs.to(device, dtype=torch_dtype)
|
|
261 |
|
262 |
gen_kwargs = {
|
263 |
"max_new_tokens": 448,
|
264 |
-
"num_beams": 1,
|
265 |
-
"condition_on_prev_tokens": False,
|
266 |
"compression_ratio_threshold": 1.35, # zlib compression ratio threshold (in token space)
|
267 |
-
"temperature": (0.0, 0.2, 0.4, 0.6, 0.8, 1.0),
|
268 |
"logprob_threshold": -1.0,
|
269 |
"no_speech_threshold": 0.6,
|
270 |
"return_timestamps": True,
|
@@ -446,7 +446,11 @@ Steps for getting started:
|
|
446 |
git clone https://github.com/ggerganov/whisper.cpp.git
|
447 |
cd whisper.cpp
|
448 |
```
|
449 |
-
2.
|
|
|
|
|
|
|
|
|
450 |
|
451 |
```python
|
452 |
from huggingface_hub import hf_hub_download
|
@@ -454,7 +458,7 @@ from huggingface_hub import hf_hub_download
|
|
454 |
hf_hub_download(repo_id='distil-whisper/distil-large-v3-ggml', filename='ggml-distil-large-v3.bin', local_dir='./models')
|
455 |
```
|
456 |
|
457 |
-
Note that if you do not have
|
458 |
|
459 |
```bash
|
460 |
wget https://huggingface.co/distil-whisper/distil-large-v3-ggml/resolve/main/ggml-distil-large-v3.bin -P ./models
|
@@ -524,17 +528,15 @@ The following code-snippet demonstrates how to transcribe a sample file from the
|
|
524 |
🤗 Datasets:
|
525 |
|
526 |
```python
|
527 |
-
import torch
|
528 |
-
from datasets import load_dataset
|
529 |
from huggingface_hub import hf_hub_download
|
|
|
530 |
from whisper import load_model, transcribe
|
531 |
|
532 |
model_path = hf_hub_download(repo_id="distil-whisper/distil-large-v3-openai", filename="model.bin")
|
533 |
model = load_model(model_path)
|
534 |
|
535 |
dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
|
536 |
-
sample = dataset[0]["audio"]["
|
537 |
-
sample = torch.from_numpy(sample).float()
|
538 |
|
539 |
pred_out = transcribe(model, audio=sample)
|
540 |
print(pred_out["text"])
|
|
|
36 |
| [distil-large-v2](https://huggingface.co/distil-whisper/distil-large-v2) | 756 | 5.8 | 9.6 | 15.6 | 11.6 |
|
37 |
|
38 |
Since the sequential algorithm is the "de-facto" transcription algorithm across the most popular Whisper libraries
|
39 |
+
(Whisper cpp, Faster-Whisper, OpenAI Whisper), this distilled model is designed to be compatible with these libraries.
|
40 |
+
You can expect significant performance gains by switching from previous Distil-Whisper checkpoints to distil-large-v3
|
41 |
+
when using these libraries. For convenience, the weights for the most popular libraries are already converted,
|
42 |
+
with instructions for getting started below.
|
43 |
|
44 |
## Table of Contents
|
45 |
|
|
|
60 |
|
61 |
## Transformers Usage
|
62 |
|
63 |
+
distil-large-v3 is supported in the Hugging Face 🤗 Transformers library from version 4.39 onwards. To run the model, first
|
64 |
install the latest version of Transformers. For this example, we'll also install 🤗 Datasets to load a toy audio dataset
|
65 |
from the Hugging Face Hub:
|
66 |
|
|
|
261 |
|
262 |
gen_kwargs = {
|
263 |
"max_new_tokens": 448,
|
264 |
+
"num_beams": 1,
|
265 |
+
"condition_on_prev_tokens": False,
|
266 |
"compression_ratio_threshold": 1.35, # zlib compression ratio threshold (in token space)
|
267 |
+
"temperature": (0.0, 0.2, 0.4, 0.6, 0.8, 1.0),
|
268 |
"logprob_threshold": -1.0,
|
269 |
"no_speech_threshold": 0.6,
|
270 |
"return_timestamps": True,
|
|
|
446 |
git clone https://github.com/ggerganov/whisper.cpp.git
|
447 |
cd whisper.cpp
|
448 |
```
|
449 |
+
2. Install the Hugging Face Hub Python package:
|
450 |
+
```bash
|
451 |
+
pip install --upgrade huggingface_hub
|
452 |
+
```
|
453 |
+
And download the GGML weights for distil-large-v3 using the following Python snippet:
|
454 |
|
455 |
```python
|
456 |
from huggingface_hub import hf_hub_download
|
|
|
458 |
hf_hub_download(repo_id='distil-whisper/distil-large-v3-ggml', filename='ggml-distil-large-v3.bin', local_dir='./models')
|
459 |
```
|
460 |
|
461 |
+
Note that if you do not have a Python environment set-up, you can also download the weights directly with `wget`:
|
462 |
|
463 |
```bash
|
464 |
wget https://huggingface.co/distil-whisper/distil-large-v3-ggml/resolve/main/ggml-distil-large-v3.bin -P ./models
|
|
|
528 |
🤗 Datasets:
|
529 |
|
530 |
```python
|
|
|
|
|
531 |
from huggingface_hub import hf_hub_download
|
532 |
+
from datasets import load_dataset
|
533 |
from whisper import load_model, transcribe
|
534 |
|
535 |
model_path = hf_hub_download(repo_id="distil-whisper/distil-large-v3-openai", filename="model.bin")
|
536 |
model = load_model(model_path)
|
537 |
|
538 |
dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
|
539 |
+
sample = dataset[0]["audio"]["path"]
|
|
|
540 |
|
541 |
pred_out = transcribe(model, audio=sample)
|
542 |
print(pred_out["text"])
|