whisper.md 3.97 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
<!--Copyright 2022 The HuggingFace Team. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
11
12
13
14

鈿狅笍 Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
rendered properly in your Markdown viewer.

15
16
17
18
19
20
21
22
23
24
25
26
-->

# Whisper

## Overview

The Whisper model was proposed in [Robust Speech Recognition via Large-Scale Weak Supervision](https://cdn.openai.com/papers/whisper.pdf) by Alec Radford, Jong Wook Kim, Tao Xu, Greg Brockman, Christine McLeavey, Ilya Sutskever.

The abstract from the paper is the following:

*We study the capabilities of speech processing systems trained simply to predict large amounts of transcripts of audio on the internet. When scaled to 680,000 hours of multilingual and multitask supervision, the resulting models generalize well to standard benchmarks and are often competitive with prior fully supervised results but in a zeroshot transfer setting without the need for any finetuning. When compared to humans, the models approach their accuracy and robustness. We are releasing models and inference code to serve as a foundation for further work on robust speech processing.*

27
28
This model was contributed by [Arthur Zucker](https://huggingface.co/ArthurZ). The Tensorflow version of this model was contributed by [amyeroberts](https://huggingface.co/amyeroberts).
The original code can be found [here](https://github.com/openai/whisper).
29

30
## Usage tips
31

amyeroberts's avatar
amyeroberts committed
32
- The model usually performs well without requiring any finetuning.
33
- The architecture follows a classic encoder-decoder architecture, which means that it relies on the [`~generation.GenerationMixin.generate`] function for inference.
34
- Inference is currently only implemented for short-form i.e. audio is pre-segmented into <=30s segments. Long-form (including timestamps) will be implemented in a future release.
35
36
37
38
39
40
41
42
43
- One can use [`WhisperProcessor`] to prepare audio for the model, and decode the predicted ID's back into text.

## WhisperConfig

[[autodoc]] WhisperConfig

## WhisperTokenizer

[[autodoc]] WhisperTokenizer
44
    - set_prefix_tokens
45
46
47
48
    - build_inputs_with_special_tokens
    - get_special_tokens_mask
    - create_token_type_ids_from_sequences
    - save_vocabulary
49
50
    - batch_decode
    - decode
51

52
53
54
55
56
57
58
59
## WhisperTokenizerFast

[[autodoc]] WhisperTokenizerFast
    - set_prefix_tokens
    - build_inputs_with_special_tokens
    - get_special_tokens_mask
    - create_token_type_ids_from_sequences
    - save_vocabulary
60
61
    - batch_decode
    - decode
62

63
64
65
66
67
68
69
70
71
72
73
74
75
76
## WhisperFeatureExtractor

[[autodoc]] WhisperFeatureExtractor
    - __call__

## WhisperProcessor

[[autodoc]] WhisperProcessor
    - __call__
    - from_pretrained
    - save_pretrained
    - batch_decode
    - decode

77
78
79
<frameworkcontent>
<pt>

80
81
82
83
## WhisperModel

[[autodoc]] WhisperModel
    - forward
84
    - _mask_input_features
85
86
87
88
89

## WhisperForConditionalGeneration

[[autodoc]] WhisperForConditionalGeneration
    - forward
90
    - generate
amyeroberts's avatar
amyeroberts committed
91

92
93
94
95
96
## WhisperForCausalLM

[[autodoc]] WhisperForCausalLM
    - forward

97
98
99
100
101
## WhisperForAudioClassification

[[autodoc]] WhisperForAudioClassification
    - forward

102
103
</pt>
<tf>
amyeroberts's avatar
amyeroberts committed
104
105
106
107
108
109
110
111
112
113

## TFWhisperModel

[[autodoc]] TFWhisperModel
    - call

## TFWhisperForConditionalGeneration

[[autodoc]] TFWhisperForConditionalGeneration
    - call
114

115
116
</tf>
<jax>
117
118
119
120
121
122
123
124
125
126

## FlaxWhisperModel

[[autodoc]] FlaxWhisperModel
    - __call__

## FlaxWhisperForConditionalGeneration

[[autodoc]] FlaxWhisperForConditionalGeneration
    - __call__
127
128
129
130
131
132

## FlaxWhisperForAudioClassification

[[autodoc]] FlaxWhisperForAudioClassification
    - __call__

133
134
135
</jax>
</frameworkcontent>