cstr commited on
Commit
855192a
1 Parent(s): fb366e9

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +577 -0
README.md ADDED
@@ -0,0 +1,577 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - zh
5
+ - de
6
+ - es
7
+ - ru
8
+ - ko
9
+ - fr
10
+ - ja
11
+ - pt
12
+ - tr
13
+ - pl
14
+ - ca
15
+ - nl
16
+ - ar
17
+ - sv
18
+ - it
19
+ - id
20
+ - hi
21
+ - fi
22
+ - vi
23
+ - he
24
+ - uk
25
+ - el
26
+ - ms
27
+ - cs
28
+ - ro
29
+ - da
30
+ - hu
31
+ - ta
32
+ - no
33
+ - th
34
+ - ur
35
+ - hr
36
+ - bg
37
+ - lt
38
+ - la
39
+ - mi
40
+ - ml
41
+ - cy
42
+ - sk
43
+ - te
44
+ - fa
45
+ - lv
46
+ - bn
47
+ - sr
48
+ - az
49
+ - sl
50
+ - kn
51
+ - et
52
+ - mk
53
+ - br
54
+ - eu
55
+ - is
56
+ - hy
57
+ - ne
58
+ - mn
59
+ - bs
60
+ - kk
61
+ - sq
62
+ - sw
63
+ - gl
64
+ - mr
65
+ - pa
66
+ - si
67
+ - km
68
+ - sn
69
+ - yo
70
+ - so
71
+ - af
72
+ - oc
73
+ - ka
74
+ - be
75
+ - tg
76
+ - sd
77
+ - gu
78
+ - am
79
+ - yi
80
+ - lo
81
+ - uz
82
+ - fo
83
+ - ht
84
+ - ps
85
+ - tk
86
+ - nn
87
+ - mt
88
+ - sa
89
+ - lb
90
+ - my
91
+ - bo
92
+ - tl
93
+ - mg
94
+ - as
95
+ - tt
96
+ - haw
97
+ - ln
98
+ - ha
99
+ - ba
100
+ - jw
101
+ - su
102
+ license: apache-2.0
103
+ tags:
104
+ - audio
105
+ - automatic-speech-recognition
106
+ - hf-asr-leaderboard
107
+ widget:
108
+ - example_title: Librispeech sample 1
109
+ src: https://cdn-media.huggingface.co/speech_samples/sample1.flac
110
+ - example_title: Librispeech sample 2
111
+ src: https://cdn-media.huggingface.co/speech_samples/sample2.flac
112
+ pipeline_tag: automatic-speech-recognition
113
+ ---
114
+
115
+ # Whisper turbo v3 for CTranslate2/faster-whisper
116
+
117
+ This is an int8 quantified version of the OpenAI Whisper v3 turbo model. You can use it like this:
118
+
119
+ ```kaggle
120
+ # Clone the repository
121
+ !git clone https://github.com/SYSTRAN/faster-whisper.git
122
+ %cd faster-whisper
123
+
124
+ # Install requirements
125
+ !pip install -r requirements.txt
126
+
127
+ # Import necessary modules
128
+ from faster_whisper import WhisperModel
129
+ from faster_whisper.transcribe import BatchedInferencePipeline
130
+
131
+ # Initialize the model
132
+ model = WhisperModel("cstr/whisper-large-v3-turbo-int8_float32", device="auto", compute_type="int8")
133
+ batched_model = BatchedInferencePipeline(model=model)
134
+
135
+ # Change to home directory and download audio
136
+ %cd ~
137
+ !wget -c https://mcdn.podbean.com/mf/web/dir5wty678b6g4vg/HoP_453_-_The_Price_is_Right_-_Law_and_Economics_in_the_Second_Scholastic5yxzh.mp3 -O audio.mp3
138
+
139
+ # Benchmark transcription time
140
+ import time
141
+ import osstart_time = time.time()
142
+ segments, info = batched_model.transcribe("audio.mp3", batch_size=16)
143
+ end_time = time.time()
144
+
145
+ # Print transcription
146
+ for segment in segments:
147
+ print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))
148
+
149
+ # Print transcription info and benchmark results
150
+ print(f"\nLanguage: {info.language}, Probability: {info.language_probability:.2f}")
151
+ print(f"Duration: {info.duration:.2f}s, Duration after VAD: {info.duration_after_vad:.2f}s")
152
+
153
+ transcription_time = end_time - start_time
154
+ print(f"\nTranscription time: {transcription_time:.2f} seconds")
155
+
156
+ # Calculate real-time factor
157
+ real_time_factor = info.duration / transcription_time
158
+ print(f"Real-time factor: {real_time_factor:.2f}x")
159
+
160
+ # Print audio file size
161
+ audio_file_size = os.path.getsize("audio.mp3") / (1024 * 1024) # Size in MB
162
+ print(f"Audio file size: {audio_file_size:.2f} MB")
163
+ ```
164
+
165
+ # Whisper (original Model Card follows)
166
+
167
+ Whisper is a state-of-the-art model for automatic speech recognition (ASR) and speech translation, proposed in the paper
168
+ [Robust Speech Recognition via Large-Scale Weak Supervision](https://huggingface.co/papers/2212.04356) by Alec Radford
169
+ et al. from OpenAI. Trained on >5M hours of labeled data, Whisper demonstrates a strong ability to generalise to many
170
+ datasets and domains in a zero-shot setting.
171
+
172
+ Whisper large-v3-turbo is a distilled version of [Whisper large-v3](https://huggingface.co/openai/whisper-large-v3). In other words, it's the exact same model, except that the number of decoding layers have reduced from 32 to 4.
173
+ As a result, the model is way faster, at the expense of a minor quality degradation.
174
+
175
+ **Disclaimer**: Content for this model card has partly been written by the 🤗 Hugging Face team, and partly copied and
176
+ pasted from the original model card.
177
+
178
+ ## Usage
179
+
180
+ Whisper large-v3-turbo is supported in Hugging Face 🤗 Transformers. To run the model, first install the Transformers
181
+ library. For this example, we'll also install 🤗 Datasets to load toy audio dataset from the Hugging Face Hub, and
182
+ 🤗 Accelerate to reduce the model loading time:
183
+
184
+ ```bash
185
+ pip install --upgrade pip
186
+ pip install --upgrade transformers datasets[audio] accelerate
187
+ ```
188
+
189
+ The model can be used with the [`pipeline`](https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.AutomaticSpeechRecognitionPipeline)
190
+ class to transcribe audios of arbitrary length:
191
+
192
+ ```python
193
+ import torch
194
+ from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
195
+ from datasets import load_dataset
196
+
197
+
198
+ device = "cuda:0" if torch.cuda.is_available() else "cpu"
199
+ torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
200
+
201
+ model_id = "ylacombe/whisper-large-v3-turbo"
202
+
203
+ model = AutoModelForSpeechSeq2Seq.from_pretrained(
204
+ model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True
205
+ )
206
+ model.to(device)
207
+
208
+ processor = AutoProcessor.from_pretrained(model_id)
209
+
210
+ pipe = pipeline(
211
+ "automatic-speech-recognition",
212
+ model=model,
213
+ tokenizer=processor.tokenizer,
214
+ feature_extractor=processor.feature_extractor,
215
+ torch_dtype=torch_dtype,
216
+ device=device,
217
+ )
218
+
219
+ dataset = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
220
+ sample = dataset[0]["audio"]
221
+
222
+ result = pipe(sample)
223
+ print(result["text"])
224
+ ```
225
+
226
+ To transcribe a local audio file, simply pass the path to your audio file when you call the pipeline:
227
+
228
+ ```python
229
+ result = pipe("audio.mp3")
230
+ ```
231
+
232
+ Multiple audio files can be transcribed in parallel by specifying them as a list and setting the `batch_size` parameter:
233
+
234
+ ```python
235
+ result = pipe(["audio_1.mp3", "audio_2.mp3"], batch_size=2)
236
+ ```
237
+
238
+ Transformers is compatible with all Whisper decoding strategies, such as temperature fallback and condition on previous
239
+ tokens. The following example demonstrates how to enable these heuristics:
240
+
241
+ ```python
242
+ generate_kwargs = {
243
+ "max_new_tokens": 448,
244
+ "num_beams": 1,
245
+ "condition_on_prev_tokens": False,
246
+ "compression_ratio_threshold": 1.35, # zlib compression ratio threshold (in token space)
247
+ "temperature": (0.0, 0.2, 0.4, 0.6, 0.8, 1.0),
248
+ "logprob_threshold": -1.0,
249
+ "no_speech_threshold": 0.6,
250
+ "return_timestamps": True,
251
+ }
252
+
253
+ result = pipe(sample, generate_kwargs=generate_kwargs)
254
+ ```
255
+
256
+ Whisper predicts the language of the source audio automatically. If the source audio language is known *a-priori*, it
257
+ can be passed as an argument to the pipeline:
258
+
259
+ ```python
260
+ result = pipe(sample, generate_kwargs={"language": "english"})
261
+ ```
262
+
263
+ By default, Whisper performs the task of *speech transcription*, where the source audio language is the same as the target
264
+ text language. To perform *speech translation*, where the target text is in English, set the task to `"translate"`:
265
+
266
+ ```python
267
+ result = pipe(sample, generate_kwargs={"task": "translate"})
268
+ ```
269
+
270
+ Finally, the model can be made to predict timestamps. For sentence-level timestamps, pass the `return_timestamps` argument:
271
+
272
+ ```python
273
+ result = pipe(sample, return_timestamps=True)
274
+ print(result["chunks"])
275
+ ```
276
+
277
+ And for word-level timestamps:
278
+
279
+ ```python
280
+ result = pipe(sample, return_timestamps="word")
281
+ print(result["chunks"])
282
+ ```
283
+
284
+ The above arguments can be used in isolation or in combination. For example, to perform the task of speech transcription
285
+ where the source audio is in French, and we want to return sentence-level timestamps, the following can be used:
286
+
287
+ ```python
288
+ result = pipe(sample, return_timestamps=True, generate_kwargs={"language": "french", "task": "translate"})
289
+ print(result["chunks"])
290
+ ```
291
+
292
+ <details>
293
+
294
+ <summary> For more control over the generation parameters, use the model + processor API directly: </summary>
295
+
296
+ ```python
297
+ import torch
298
+ from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor
299
+ from datasets import Audio, load_dataset
300
+
301
+
302
+ device = "cuda:0" if torch.cuda.is_available() else "cpu"
303
+ torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
304
+
305
+ model_id = "ylacombe/whisper-large-v3-turbo"
306
+
307
+ model = AutoModelForSpeechSeq2Seq.from_pretrained(
308
+ model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True
309
+ )
310
+ model.to(device)
311
+
312
+ processor = AutoProcessor.from_pretrained(model_id)
313
+
314
+ dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
315
+ dataset = dataset.cast_column("audio", Audio(processor.feature_extractor.sampling_rate))
316
+ sample = dataset[0]["audio"]
317
+
318
+ inputs = processor(
319
+ sample["array"],
320
+ sampling_rate=sample["sampling_rate"],
321
+ return_tensors="pt",
322
+ truncation=False,
323
+ padding="longest",
324
+ return_attention_mask=True,
325
+ )
326
+ inputs = inputs.to(device, dtype=torch_dtype)
327
+
328
+ gen_kwargs = {
329
+ "max_new_tokens": 448,
330
+ "num_beams": 1,
331
+ "condition_on_prev_tokens": False,
332
+ "compression_ratio_threshold": 1.35, # zlib compression ratio threshold (in token space)
333
+ "temperature": (0.0, 0.2, 0.4, 0.6, 0.8, 1.0),
334
+ "logprob_threshold": -1.0,
335
+ "no_speech_threshold": 0.6,
336
+ "return_timestamps": True,
337
+ }
338
+
339
+ pred_ids = model.generate(**inputs, **gen_kwargs)
340
+ pred_text = processor.batch_decode(pred_ids, skip_special_tokens=True, decode_with_timestamps=False)
341
+
342
+ print(pred_text)
343
+ ```
344
+
345
+ </details>
346
+
347
+ ## Additional Speed & Memory Improvements
348
+
349
+ You can apply additional speed and memory improvements to Whisper to further reduce the inference speed and VRAM
350
+ requirements.
351
+
352
+ ### Chunked Long-Form
353
+
354
+ Whisper has a receptive field of 30-seconds. To transcribe audios longer than this, one of two long-form algorithms are
355
+ required:
356
+ 1. **Sequential:** uses a "sliding window" for buffered inference, transcribing 30-second slices one after the other
357
+ 2. **Chunked:** splits long audio files into shorter ones (with a small overlap between segments), transcribes each segment independently, and stitches the resulting transcriptions at the boundaries
358
+
359
+ The sequential long-form algorithm should be used in either of the following scenarios:
360
+ 1. Transcription accuracy is the most important factor, and speed is less of a consideration
361
+ 2. You are transcribing **batches** of long audio files, in which case the latency of sequential is comparable to chunked, while being up to 0.5% WER more accurate
362
+
363
+ Conversely, the chunked algorithm should be used when:
364
+ 1. Transcription speed is the most important factor
365
+ 2. You are transcribing a **single** long audio file
366
+
367
+ By default, Transformers uses the sequential algorithm. To enable the chunked algorithm, pass the `chunk_length_s`
368
+ parameter to the `pipeline`. For large-v3, a chunk length of 30-seconds is optimal. To activate batching over long
369
+ audio files, pass the argument `batch_size`:
370
+
371
+ ```python
372
+ import torch
373
+ from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
374
+ from datasets import load_dataset
375
+
376
+
377
+ device = "cuda:0" if torch.cuda.is_available() else "cpu"
378
+ torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
379
+
380
+ model_id = "ylacombe/whisper-large-v3-turbo"
381
+
382
+ model = AutoModelForSpeechSeq2Seq.from_pretrained(
383
+ model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True
384
+ )
385
+ model.to(device)
386
+
387
+ processor = AutoProcessor.from_pretrained(model_id)
388
+
389
+ pipe = pipeline(
390
+ "automatic-speech-recognition",
391
+ model=model,
392
+ tokenizer=processor.tokenizer,
393
+ feature_extractor=processor.feature_extractor,
394
+ chunk_length_s=30,
395
+ batch_size=16, # batch size for inference - set based on your device
396
+ torch_dtype=torch_dtype,
397
+ device=device,
398
+ )
399
+
400
+ dataset = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
401
+ sample = dataset[0]["audio"]
402
+
403
+ result = pipe(sample)
404
+ print(result["text"])
405
+ ```
406
+
407
+ #### Torch compile
408
+
409
+ The Whisper forward pass is compatible with [`torch.compile`](https://pytorch.org/docs/stable/generated/torch.compile.html)
410
+ for 4.5x speed-ups.
411
+
412
+ **Note:** `torch.compile` is currently not compatible with the Chunked long-form algorithm or Flash Attention 2 ⚠️
413
+
414
+ ```python
415
+ import torch
416
+ from torch.nn.attention import SDPBackend, sdpa_kernel
417
+ from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
418
+ from datasets import load_dataset
419
+ from tqdm import tqdm
420
+
421
+ torch.set_float32_matmul_precision("high")
422
+
423
+ device = "cuda:0" if torch.cuda.is_available() else "cpu"
424
+ torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
425
+
426
+ model_id = "ylacombe/whisper-large-v3-turbo"
427
+
428
+ model = AutoModelForSpeechSeq2Seq.from_pretrained(
429
+ model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True
430
+ ).to(device)
431
+
432
+ # Enable static cache and compile the forward pass
433
+ model.generation_config.cache_implementation = "static"
434
+ model.generation_config.max_new_tokens = 256
435
+ model.forward = torch.compile(model.forward, mode="reduce-overhead", fullgraph=True)
436
+
437
+ processor = AutoProcessor.from_pretrained(model_id)
438
+
439
+ pipe = pipeline(
440
+ "automatic-speech-recognition",
441
+ model=model,
442
+ tokenizer=processor.tokenizer,
443
+ feature_extractor=processor.feature_extractor,
444
+ torch_dtype=torch_dtype,
445
+ device=device,
446
+ )
447
+
448
+ dataset = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
449
+ sample = dataset[0]["audio"]
450
+
451
+ # 2 warmup steps
452
+ for _ in tqdm(range(2), desc="Warm-up step"):
453
+ with sdpa_kernel(SDPBackend.MATH):
454
+ result = pipe(sample.copy(), generate_kwargs={"min_new_tokens": 256, "max_new_tokens": 256})
455
+
456
+ # fast run
457
+ with sdpa_kernel(SDPBackend.MATH):
458
+ result = pipe(sample.copy())
459
+
460
+ print(result["text"])
461
+ ```
462
+
463
+ #### Flash Attention 2
464
+
465
+ We recommend using [Flash-Attention 2](https://huggingface.co/docs/transformers/main/en/perf_infer_gpu_one#flashattention-2) if your GPU supports it and you are not using [torch.compile](#torch-compile).
466
+ To do so, first install [Flash Attention](https://github.com/Dao-AILab/flash-attention):
467
+
468
+ ```
469
+ pip install flash-attn --no-build-isolation
470
+ ```
471
+
472
+ Then pass `attn_implementation="flash_attention_2"` to `from_pretrained`:
473
+
474
+ ```python
475
+ model = AutoModelForSpeechSeq2Seq.from_pretrained(model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, attn_implementation="flash_attention_2")
476
+ ```
477
+
478
+ #### Torch Scale-Product-Attention (SDPA)
479
+
480
+ If your GPU does not support Flash Attention, we recommend making use of PyTorch [scaled dot-product attention (SDPA)](https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html).
481
+ This attention implementation is activated **by default** for PyTorch versions 2.1.1 or greater. To check
482
+ whether you have a compatible PyTorch version, run the following Python code snippet:
483
+
484
+ ```python
485
+ from transformers.utils import is_torch_sdpa_available
486
+
487
+ print(is_torch_sdpa_available())
488
+ ```
489
+
490
+ If the above returns `True`, you have a valid version of PyTorch installed and SDPA is activated by default. If it
491
+ returns `False`, you need to upgrade your PyTorch version according to the [official instructions](https://pytorch.org/get-started/locally/)
492
+
493
+ Once a valid PyTorch version is installed, SDPA is activated by default. It can also be set explicitly by specifying
494
+ `attn_implementation="sdpa"` as follows:
495
+
496
+ ```python
497
+ model = AutoModelForSpeechSeq2Seq.from_pretrained(model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, attn_implementation="sdpa")
498
+ ```
499
+
500
+ For more information about how to use the SDPA refer to the [Transformers SDPA documentation](https://huggingface.co/docs/transformers/en/perf_infer_gpu_one#pytorch-scaled-dot-product-attention).
501
+
502
+
503
+ ## Model details
504
+
505
+ Whisper is a Transformer based encoder-decoder model, also referred to as a _sequence-to-sequence_ model. There are two
506
+ flavours of Whisper model: English-only and multilingual. The English-only models were trained on the task of English
507
+ speech recognition. The multilingual models were trained simultaneously on multilingual speech recognition and speech
508
+ translation. For speech recognition, the model predicts transcriptions in the *same* language as the audio. For speech
509
+ translation, the model predicts transcriptions to a *different* language to the audio.
510
+
511
+ Whisper checkpoints come in five configurations of varying model sizes. The smallest four are available as English-only
512
+ and multilingual. The largest checkpoints are multilingual only. All ten of the pre-trained checkpoints
513
+ are available on the [Hugging Face Hub](https://huggingface.co/models?search=openai/whisper). The
514
+ checkpoints are summarised in the following table with links to the models on the Hub:
515
+
516
+ | Size | Parameters | English-only | Multilingual |
517
+ |----------|------------|------------------------------------------------------|-----------------------------------------------------|
518
+ | tiny | 39 M | [✓](https://huggingface.co/openai/whisper-tiny.en) | [✓](https://huggingface.co/openai/whisper-tiny) |
519
+ | base | 74 M | [✓](https://huggingface.co/openai/whisper-base.en) | [✓](https://huggingface.co/openai/whisper-base) |
520
+ | small | 244 M | [✓](https://huggingface.co/openai/whisper-small.en) | [✓](https://huggingface.co/openai/whisper-small) |
521
+ | medium | 769 M | [✓](https://huggingface.co/openai/whisper-medium.en) | [✓](https://huggingface.co/openai/whisper-medium) |
522
+ | large | 1550 M | x | [✓](https://huggingface.co/openai/whisper-large) |
523
+ | large-v2 | 1550 M | x | [✓](https://huggingface.co/openai/whisper-large-v2) |
524
+ | large-v3 | 1550 M | x | [✓](https://huggingface.co/openai/whisper-large-v3) |
525
+ | large-v3-turbo | 809 M | x | [✓](https://huggingface.co/ylacombe/whisper-large-v3-turbo) |
526
+
527
+
528
+ ## Fine-Tuning
529
+
530
+ The pre-trained Whisper model demonstrates a strong ability to generalise to different datasets and domains. However,
531
+ its predictive capabilities can be improved further for certain languages and tasks through *fine-tuning*. The blog
532
+ post [Fine-Tune Whisper with 🤗 Transformers](https://huggingface.co/blog/fine-tune-whisper) provides a step-by-step
533
+ guide to fine-tuning the Whisper model with as little as 5 hours of labelled data.
534
+
535
+ ### Evaluated Use
536
+
537
+ The primary intended users of these models are AI researchers studying robustness, generalization, capabilities, biases, and constraints of the current model. However, Whisper is also potentially quite useful as an ASR solution for developers, especially for English speech recognition. We recognize that once models are released, it is impossible to restrict access to only “intended” uses or to draw reasonable guidelines around what is or is not research.
538
+
539
+ The models are primarily trained and evaluated on ASR and speech translation to English tasks. They show strong ASR results in ~10 languages. They may exhibit additional capabilities, particularly if fine-tuned on certain tasks like voice activity detection, speaker classification, or speaker diarization but have not been robustly evaluated in these areas. We strongly recommend that users perform robust evaluations of the models in a particular context and domain before deploying them.
540
+
541
+ In particular, we caution against using Whisper models to transcribe recordings of individuals taken without their consent or purporting to use these models for any kind of subjective classification. We recommend against use in high-risk domains like decision-making contexts, where flaws in accuracy can lead to pronounced flaws in outcomes. The models are intended to transcribe and translate speech, use of the model for classification is not only not evaluated but also not appropriate, particularly to infer human attributes.
542
+
543
+
544
+ ## Training Data
545
+
546
+ No information provided.
547
+
548
+ ## Performance and Limitations
549
+
550
+ Our studies show that, over many existing ASR systems, the models exhibit improved robustness to accents, background noise, technical language, as well as zero shot translation from multiple languages into English; and that accuracy on speech recognition and translation is near the state-of-the-art level.
551
+
552
+ However, because the models are trained in a weakly supervised manner using large-scale noisy data, the predictions may include texts that are not actually spoken in the audio input (i.e. hallucination). We hypothesize that this happens because, given their general knowledge of language, the models combine trying to predict the next word in audio with trying to transcribe the audio itself.
553
+
554
+ Our models perform unevenly across languages, and we observe lower accuracy on low-resource and/or low-discoverability languages or languages where we have less training data. The models also exhibit disparate performance on different accents and dialects of particular languages, which may include higher word error rate across speakers of different genders, races, ages, or other demographic criteria. Our full evaluation results are presented in [the paper accompanying this release](https://cdn.openai.com/papers/whisper.pdf).
555
+
556
+ In addition, the sequence-to-sequence architecture of the model makes it prone to generating repetitive texts, which can be mitigated to some degree by beam search and temperature scheduling but not perfectly. Further analysis on these limitations are provided in [the paper](https://cdn.openai.com/papers/whisper.pdf). It is likely that this behavior and hallucinations may be worse on lower-resource and/or lower-discoverability languages.
557
+
558
+
559
+ ## Broader Implications
560
+
561
+ We anticipate that Whisper models’ transcription capabilities may be used for improving accessibility tools. While Whisper models cannot be used for real-time transcription out of the box – their speed and size suggest that others may be able to build applications on top of them that allow for near-real-time speech recognition and translation. The real value of beneficial applications built on top of Whisper models suggests that the disparate performance of these models may have real economic implications.
562
+
563
+ There are also potential dual use concerns that come with releasing Whisper. While we hope the technology will be used primarily for beneficial purposes, making ASR technology more accessible could enable more actors to build capable surveillance technologies or scale up existing surveillance efforts, as the speed and accuracy allow for affordable automatic transcription and translation of large volumes of audio communication. Moreover, these models may have some capabilities to recognize specific individuals out of the box, which in turn presents safety concerns related both to dual use and disparate performance. In practice, we expect that the cost of transcription is not the limiting factor of scaling up surveillance projects.
564
+
565
+
566
+ ### BibTeX entry and citation info
567
+ ```bibtex
568
+ @misc{radford2022whisper,
569
+ doi = {10.48550/ARXIV.2212.04356},
570
+ url = {https://arxiv.org/abs/2212.04356},
571
+ author = {Radford, Alec and Kim, Jong Wook and Xu, Tao and Brockman, Greg and McLeavey, Christine and Sutskever, Ilya},
572
+ title = {Robust Speech Recognition via Large-Scale Weak Supervision},
573
+ publisher = {arXiv},
574
+ year = {2022},
575
+ copyright = {arXiv.org perpetual, non-exclusive license}
576
+ }
577
+ ```