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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
README.md
CHANGED
|
@@ -1,3 +1,541 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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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 |
+
base_model:
|
| 103 |
+
- openai/whisper-large-v3
|
| 104 |
+
base_model_relation: quantized
|
| 105 |
+
tags:
|
| 106 |
+
- audio
|
| 107 |
+
- automatic-speech-recognition
|
| 108 |
+
- ctranslate2
|
| 109 |
+
widget:
|
| 110 |
+
- example_title: Librispeech sample 1
|
| 111 |
+
src: https://cdn-media.huggingface.co/speech_samples/sample1.flac
|
| 112 |
+
- example_title: Librispeech sample 2
|
| 113 |
+
src: https://cdn-media.huggingface.co/speech_samples/sample2.flac
|
| 114 |
+
pipeline_tag: automatic-speech-recognition
|
| 115 |
+
license: apache-2.0
|
| 116 |
+
---
|
| 117 |
+
|
| 118 |
+
# Whisper
|
| 119 |
+
|
| 120 |
+
Whisper is a state-of-the-art model for automatic speech recognition (ASR) and speech translation, proposed in the paper
|
| 121 |
+
[Robust Speech Recognition via Large-Scale Weak Supervision](https://huggingface.co/papers/2212.04356) by Alec Radford
|
| 122 |
+
et al. from OpenAI. Trained on >5M hours of labeled data, Whisper demonstrates a strong ability to generalise to many
|
| 123 |
+
datasets and domains in a zero-shot setting.
|
| 124 |
+
|
| 125 |
+
Whisper large-v3 has the same architecture as the previous [large](https://huggingface.co/openai/whisper-large) and [large-v2](https://huggingface.co/openai/whisper-large-v2)
|
| 126 |
+
models, except for the following minor differences:
|
| 127 |
+
|
| 128 |
+
1. The spectrogram input uses 128 Mel frequency bins instead of 80
|
| 129 |
+
2. A new language token for Cantonese
|
| 130 |
+
|
| 131 |
+
The Whisper large-v3 model was trained on 1 million hours of weakly labeled audio and 4 million hours of pseudo-labeled
|
| 132 |
+
audio collected using Whisper [large-v2](https://huggingface.co/openai/whisper-large-v2) . The model was trained for 2.0 epochs over this mixture dataset.
|
| 133 |
+
|
| 134 |
+
The large-v3 model shows improved performance over a wide variety of languages, showing 10% to 20% reduction of errors
|
| 135 |
+
compared to Whisper [large-v2](https://huggingface.co/openai/whisper-large-v2) . For more details on the different checkpoints available, refer to the section [Model details](#model-details).
|
| 136 |
+
|
| 137 |
+
**Disclaimer**: Content for this model card has partly been written by the 🤗 Hugging Face team, and partly copied and
|
| 138 |
+
pasted from the original model card.
|
| 139 |
+
|
| 140 |
+
## Usage
|
| 141 |
+
|
| 142 |
+
Whisper large-v3 is supported in Hugging Face 🤗 Transformers. To run the model, first install the Transformers
|
| 143 |
+
library. For this example, we'll also install 🤗 Datasets to load toy audio dataset from the Hugging Face Hub, and
|
| 144 |
+
🤗 Accelerate to reduce the model loading time:
|
| 145 |
+
|
| 146 |
+
```bash
|
| 147 |
+
pip install --upgrade pip
|
| 148 |
+
pip install --upgrade transformers datasets[audio] accelerate
|
| 149 |
+
```
|
| 150 |
+
|
| 151 |
+
The model can be used with the [`pipeline`](https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.AutomaticSpeechRecognitionPipeline)
|
| 152 |
+
class to transcribe audios of arbitrary length:
|
| 153 |
+
|
| 154 |
+
```python
|
| 155 |
+
import torch
|
| 156 |
+
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
|
| 157 |
+
from datasets import load_dataset
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 161 |
+
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
| 162 |
+
|
| 163 |
+
model_id = "openai/whisper-large-v3"
|
| 164 |
+
|
| 165 |
+
model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
| 166 |
+
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True
|
| 167 |
+
)
|
| 168 |
+
model.to(device)
|
| 169 |
+
|
| 170 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
| 171 |
+
|
| 172 |
+
pipe = pipeline(
|
| 173 |
+
"automatic-speech-recognition",
|
| 174 |
+
model=model,
|
| 175 |
+
tokenizer=processor.tokenizer,
|
| 176 |
+
feature_extractor=processor.feature_extractor,
|
| 177 |
+
torch_dtype=torch_dtype,
|
| 178 |
+
device=device,
|
| 179 |
+
)
|
| 180 |
+
|
| 181 |
+
dataset = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
|
| 182 |
+
sample = dataset[0]["audio"]
|
| 183 |
+
|
| 184 |
+
result = pipe(sample)
|
| 185 |
+
print(result["text"])
|
| 186 |
+
```
|
| 187 |
+
|
| 188 |
+
To transcribe a local audio file, simply pass the path to your audio file when you call the pipeline:
|
| 189 |
+
|
| 190 |
+
```python
|
| 191 |
+
result = pipe("audio.mp3")
|
| 192 |
+
```
|
| 193 |
+
|
| 194 |
+
Multiple audio files can be transcribed in parallel by specifying them as a list and setting the `batch_size` parameter:
|
| 195 |
+
|
| 196 |
+
```python
|
| 197 |
+
result = pipe(["audio_1.mp3", "audio_2.mp3"], batch_size=2)
|
| 198 |
+
```
|
| 199 |
+
|
| 200 |
+
Transformers is compatible with all Whisper decoding strategies, such as temperature fallback and condition on previous
|
| 201 |
+
tokens. The following example demonstrates how to enable these heuristics:
|
| 202 |
+
|
| 203 |
+
```python
|
| 204 |
+
generate_kwargs = {
|
| 205 |
+
"max_new_tokens": 448,
|
| 206 |
+
"num_beams": 1,
|
| 207 |
+
"condition_on_prev_tokens": False,
|
| 208 |
+
"compression_ratio_threshold": 1.35, # zlib compression ratio threshold (in token space)
|
| 209 |
+
"temperature": (0.0, 0.2, 0.4, 0.6, 0.8, 1.0),
|
| 210 |
+
"logprob_threshold": -1.0,
|
| 211 |
+
"no_speech_threshold": 0.6,
|
| 212 |
+
"return_timestamps": True,
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
result = pipe(sample, generate_kwargs=generate_kwargs)
|
| 216 |
+
```
|
| 217 |
+
|
| 218 |
+
Whisper predicts the language of the source audio automatically. If the source audio language is known *a-priori*, it
|
| 219 |
+
can be passed as an argument to the pipeline:
|
| 220 |
+
|
| 221 |
+
```python
|
| 222 |
+
result = pipe(sample, generate_kwargs={"language": "english"})
|
| 223 |
+
```
|
| 224 |
+
|
| 225 |
+
By default, Whisper performs the task of *speech transcription*, where the source audio language is the same as the target
|
| 226 |
+
text language. To perform *speech translation*, where the target text is in English, set the task to `"translate"`:
|
| 227 |
+
|
| 228 |
+
```python
|
| 229 |
+
result = pipe(sample, generate_kwargs={"task": "translate"})
|
| 230 |
+
```
|
| 231 |
+
|
| 232 |
+
Finally, the model can be made to predict timestamps. For sentence-level timestamps, pass the `return_timestamps` argument:
|
| 233 |
+
|
| 234 |
+
```python
|
| 235 |
+
result = pipe(sample, return_timestamps=True)
|
| 236 |
+
print(result["chunks"])
|
| 237 |
+
```
|
| 238 |
+
|
| 239 |
+
And for word-level timestamps:
|
| 240 |
+
|
| 241 |
+
```python
|
| 242 |
+
result = pipe(sample, return_timestamps="word")
|
| 243 |
+
print(result["chunks"])
|
| 244 |
+
```
|
| 245 |
+
|
| 246 |
+
The above arguments can be used in isolation or in combination. For example, to perform the task of speech transcription
|
| 247 |
+
where the source audio is in French, and we want to return sentence-level timestamps, the following can be used:
|
| 248 |
+
|
| 249 |
+
```python
|
| 250 |
+
result = pipe(sample, return_timestamps=True, generate_kwargs={"language": "french", "task": "translate"})
|
| 251 |
+
print(result["chunks"])
|
| 252 |
+
```
|
| 253 |
+
|
| 254 |
+
<details>
|
| 255 |
+
|
| 256 |
+
<summary> For more control over the generation parameters, use the model + processor API directly: </summary>
|
| 257 |
+
|
| 258 |
+
```python
|
| 259 |
+
import torch
|
| 260 |
+
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor
|
| 261 |
+
from datasets import Audio, load_dataset
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 265 |
+
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
| 266 |
+
|
| 267 |
+
model_id = "openai/whisper-large-v3"
|
| 268 |
+
|
| 269 |
+
model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
| 270 |
+
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True
|
| 271 |
+
)
|
| 272 |
+
model.to(device)
|
| 273 |
+
|
| 274 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
| 275 |
+
|
| 276 |
+
dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
|
| 277 |
+
dataset = dataset.cast_column("audio", Audio(processor.feature_extractor.sampling_rate))
|
| 278 |
+
sample = dataset[0]["audio"]
|
| 279 |
+
|
| 280 |
+
inputs = processor(
|
| 281 |
+
sample["array"],
|
| 282 |
+
sampling_rate=sample["sampling_rate"],
|
| 283 |
+
return_tensors="pt",
|
| 284 |
+
truncation=False,
|
| 285 |
+
padding="longest",
|
| 286 |
+
return_attention_mask=True,
|
| 287 |
+
)
|
| 288 |
+
inputs = inputs.to(device, dtype=torch_dtype)
|
| 289 |
+
|
| 290 |
+
gen_kwargs = {
|
| 291 |
+
"max_new_tokens": 448,
|
| 292 |
+
"num_beams": 1,
|
| 293 |
+
"condition_on_prev_tokens": False,
|
| 294 |
+
"compression_ratio_threshold": 1.35, # zlib compression ratio threshold (in token space)
|
| 295 |
+
"temperature": (0.0, 0.2, 0.4, 0.6, 0.8, 1.0),
|
| 296 |
+
"logprob_threshold": -1.0,
|
| 297 |
+
"no_speech_threshold": 0.6,
|
| 298 |
+
"return_timestamps": True,
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
pred_ids = model.generate(**inputs, **gen_kwargs)
|
| 302 |
+
pred_text = processor.batch_decode(pred_ids, skip_special_tokens=True, decode_with_timestamps=False)
|
| 303 |
+
|
| 304 |
+
print(pred_text)
|
| 305 |
+
```
|
| 306 |
+
|
| 307 |
+
</details>
|
| 308 |
+
|
| 309 |
+
## Additional Speed & Memory Improvements
|
| 310 |
+
|
| 311 |
+
You can apply additional speed and memory improvements to Whisper to further reduce the inference speed and VRAM
|
| 312 |
+
requirements.
|
| 313 |
+
|
| 314 |
+
### Chunked Long-Form
|
| 315 |
+
|
| 316 |
+
Whisper has a receptive field of 30-seconds. To transcribe audios longer than this, one of two long-form algorithms are
|
| 317 |
+
required:
|
| 318 |
+
1. **Sequential:** uses a "sliding window" for buffered inference, transcribing 30-second slices one after the other
|
| 319 |
+
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
|
| 320 |
+
|
| 321 |
+
The sequential long-form algorithm should be used in either of the following scenarios:
|
| 322 |
+
1. Transcription accuracy is the most important factor, and speed is less of a consideration
|
| 323 |
+
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
|
| 324 |
+
|
| 325 |
+
Conversely, the chunked algorithm should be used when:
|
| 326 |
+
1. Transcription speed is the most important factor
|
| 327 |
+
2. You are transcribing a **single** long audio file
|
| 328 |
+
|
| 329 |
+
By default, Transformers uses the sequential algorithm. To enable the chunked algorithm, pass the `chunk_length_s`
|
| 330 |
+
parameter to the `pipeline`. For large-v3, a chunk length of 30-seconds is optimal. To activate batching over long
|
| 331 |
+
audio files, pass the argument `batch_size`:
|
| 332 |
+
|
| 333 |
+
```python
|
| 334 |
+
import torch
|
| 335 |
+
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
|
| 336 |
+
from datasets import load_dataset
|
| 337 |
+
|
| 338 |
+
|
| 339 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 340 |
+
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
| 341 |
+
|
| 342 |
+
model_id = "openai/whisper-large-v3"
|
| 343 |
+
|
| 344 |
+
model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
| 345 |
+
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True
|
| 346 |
+
)
|
| 347 |
+
model.to(device)
|
| 348 |
+
|
| 349 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
| 350 |
+
|
| 351 |
+
pipe = pipeline(
|
| 352 |
+
"automatic-speech-recognition",
|
| 353 |
+
model=model,
|
| 354 |
+
tokenizer=processor.tokenizer,
|
| 355 |
+
feature_extractor=processor.feature_extractor,
|
| 356 |
+
chunk_length_s=30,
|
| 357 |
+
batch_size=16, # batch size for inference - set based on your device
|
| 358 |
+
torch_dtype=torch_dtype,
|
| 359 |
+
device=device,
|
| 360 |
+
)
|
| 361 |
+
|
| 362 |
+
dataset = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
|
| 363 |
+
sample = dataset[0]["audio"]
|
| 364 |
+
|
| 365 |
+
result = pipe(sample)
|
| 366 |
+
print(result["text"])
|
| 367 |
+
```
|
| 368 |
+
|
| 369 |
+
#### Torch compile
|
| 370 |
+
|
| 371 |
+
The Whisper forward pass is compatible with [`torch.compile`](https://pytorch.org/docs/stable/generated/torch.compile.html)
|
| 372 |
+
for 4.5x speed-ups.
|
| 373 |
+
|
| 374 |
+
**Note:** `torch.compile` is currently not compatible with the Chunked long-form algorithm or Flash Attention 2 ⚠️
|
| 375 |
+
|
| 376 |
+
```python
|
| 377 |
+
import torch
|
| 378 |
+
from torch.nn.attention import SDPBackend, sdpa_kernel
|
| 379 |
+
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
|
| 380 |
+
from datasets import load_dataset
|
| 381 |
+
from tqdm import tqdm
|
| 382 |
+
|
| 383 |
+
torch.set_float32_matmul_precision("high")
|
| 384 |
+
|
| 385 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 386 |
+
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
| 387 |
+
|
| 388 |
+
model_id = "openai/whisper-large-v3"
|
| 389 |
+
|
| 390 |
+
model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
| 391 |
+
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True
|
| 392 |
+
).to(device)
|
| 393 |
+
|
| 394 |
+
# Enable static cache and compile the forward pass
|
| 395 |
+
model.generation_config.cache_implementation = "static"
|
| 396 |
+
model.generation_config.max_new_tokens = 256
|
| 397 |
+
model.forward = torch.compile(model.forward, mode="reduce-overhead", fullgraph=True)
|
| 398 |
+
|
| 399 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
| 400 |
+
|
| 401 |
+
pipe = pipeline(
|
| 402 |
+
"automatic-speech-recognition",
|
| 403 |
+
model=model,
|
| 404 |
+
tokenizer=processor.tokenizer,
|
| 405 |
+
feature_extractor=processor.feature_extractor,
|
| 406 |
+
torch_dtype=torch_dtype,
|
| 407 |
+
device=device,
|
| 408 |
+
)
|
| 409 |
+
|
| 410 |
+
dataset = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
|
| 411 |
+
sample = dataset[0]["audio"]
|
| 412 |
+
|
| 413 |
+
# 2 warmup steps
|
| 414 |
+
for _ in tqdm(range(2), desc="Warm-up step"):
|
| 415 |
+
with sdpa_kernel(SDPBackend.MATH):
|
| 416 |
+
result = pipe(sample.copy(), generate_kwargs={"min_new_tokens": 256, "max_new_tokens": 256})
|
| 417 |
+
|
| 418 |
+
# fast run
|
| 419 |
+
with sdpa_kernel(SDPBackend.MATH):
|
| 420 |
+
result = pipe(sample.copy())
|
| 421 |
+
|
| 422 |
+
print(result["text"])
|
| 423 |
+
```
|
| 424 |
+
|
| 425 |
+
#### Flash Attention 2
|
| 426 |
+
|
| 427 |
+
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).
|
| 428 |
+
To do so, first install [Flash Attention](https://github.com/Dao-AILab/flash-attention):
|
| 429 |
+
|
| 430 |
+
```
|
| 431 |
+
pip install flash-attn --no-build-isolation
|
| 432 |
+
```
|
| 433 |
+
|
| 434 |
+
Then pass `attn_implementation="flash_attention_2"` to `from_pretrained`:
|
| 435 |
+
|
| 436 |
+
```python
|
| 437 |
+
model = AutoModelForSpeechSeq2Seq.from_pretrained(model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, attn_implementation="flash_attention_2")
|
| 438 |
+
```
|
| 439 |
+
|
| 440 |
+
#### Torch Scale-Product-Attention (SDPA)
|
| 441 |
+
|
| 442 |
+
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).
|
| 443 |
+
This attention implementation is activated **by default** for PyTorch versions 2.1.1 or greater. To check
|
| 444 |
+
whether you have a compatible PyTorch version, run the following Python code snippet:
|
| 445 |
+
|
| 446 |
+
```python
|
| 447 |
+
from transformers.utils import is_torch_sdpa_available
|
| 448 |
+
|
| 449 |
+
print(is_torch_sdpa_available())
|
| 450 |
+
```
|
| 451 |
+
|
| 452 |
+
If the above returns `True`, you have a valid version of PyTorch installed and SDPA is activated by default. If it
|
| 453 |
+
returns `False`, you need to upgrade your PyTorch version according to the [official instructions](https://pytorch.org/get-started/locally/)
|
| 454 |
+
|
| 455 |
+
Once a valid PyTorch version is installed, SDPA is activated by default. It can also be set explicitly by specifying
|
| 456 |
+
`attn_implementation="sdpa"` as follows:
|
| 457 |
+
|
| 458 |
+
```python
|
| 459 |
+
model = AutoModelForSpeechSeq2Seq.from_pretrained(model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, attn_implementation="sdpa")
|
| 460 |
+
```
|
| 461 |
+
|
| 462 |
+
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).
|
| 463 |
+
|
| 464 |
+
|
| 465 |
+
## Model details
|
| 466 |
+
|
| 467 |
+
Whisper is a Transformer based encoder-decoder model, also referred to as a _sequence-to-sequence_ model. There are two
|
| 468 |
+
flavours of Whisper model: English-only and multilingual. The English-only models were trained on the task of English
|
| 469 |
+
speech recognition. The multilingual models were trained simultaneously on multilingual speech recognition and speech
|
| 470 |
+
translation. For speech recognition, the model predicts transcriptions in the *same* language as the audio. For speech
|
| 471 |
+
translation, the model predicts transcriptions to a *different* language to the audio.
|
| 472 |
+
|
| 473 |
+
Whisper checkpoints come in five configurations of varying model sizes. The smallest four are available as English-only
|
| 474 |
+
and multilingual. The largest checkpoints are multilingual only. All ten of the pre-trained checkpoints
|
| 475 |
+
are available on the [Hugging Face Hub](https://huggingface.co/models?search=openai/whisper). The
|
| 476 |
+
checkpoints are summarised in the following table with links to the models on the Hub:
|
| 477 |
+
|
| 478 |
+
| Size | Parameters | English-only | Multilingual |
|
| 479 |
+
|----------|------------|------------------------------------------------------|-----------------------------------------------------|
|
| 480 |
+
| tiny | 39 M | [✓](https://huggingface.co/openai/whisper-tiny.en) | [✓](https://huggingface.co/openai/whisper-tiny) |
|
| 481 |
+
| base | 74 M | [✓](https://huggingface.co/openai/whisper-base.en) | [✓](https://huggingface.co/openai/whisper-base) |
|
| 482 |
+
| small | 244 M | [✓](https://huggingface.co/openai/whisper-small.en) | [✓](https://huggingface.co/openai/whisper-small) |
|
| 483 |
+
| medium | 769 M | [✓](https://huggingface.co/openai/whisper-medium.en) | [✓](https://huggingface.co/openai/whisper-medium) |
|
| 484 |
+
| large | 1550 M | x | [✓](https://huggingface.co/openai/whisper-large) |
|
| 485 |
+
| large-v2 | 1550 M | x | [✓](https://huggingface.co/openai/whisper-large-v2) |
|
| 486 |
+
| large-v3 | 1550 M | x | [✓](https://huggingface.co/openai/whisper-large-v3) |
|
| 487 |
+
|
| 488 |
+
|
| 489 |
+
## Fine-Tuning
|
| 490 |
+
|
| 491 |
+
The pre-trained Whisper model demonstrates a strong ability to generalise to different datasets and domains. However,
|
| 492 |
+
its predictive capabilities can be improved further for certain languages and tasks through *fine-tuning*. The blog
|
| 493 |
+
post [Fine-Tune Whisper with 🤗 Transformers](https://huggingface.co/blog/fine-tune-whisper) provides a step-by-step
|
| 494 |
+
guide to fine-tuning the Whisper model with as little as 5 hours of labelled data.
|
| 495 |
+
|
| 496 |
+
### Evaluated Use
|
| 497 |
+
|
| 498 |
+
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.
|
| 499 |
+
|
| 500 |
+
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.
|
| 501 |
+
|
| 502 |
+
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.
|
| 503 |
+
|
| 504 |
+
|
| 505 |
+
## Training Data
|
| 506 |
+
|
| 507 |
+
The large-v3 checkpoint is trained on 1 million hours of weakly labeled audio and 4 million hours of pseudo-labeled audio collected using Whisper large-v2.
|
| 508 |
+
|
| 509 |
+
As discussed in [the accompanying paper](https://cdn.openai.com/papers/whisper.pdf), we see that performance on transcription in a given language is directly correlated with the amount of training data we employ in that language.
|
| 510 |
+
|
| 511 |
+
|
| 512 |
+
## Performance and Limitations
|
| 513 |
+
|
| 514 |
+
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.
|
| 515 |
+
|
| 516 |
+
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.
|
| 517 |
+
|
| 518 |
+
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).
|
| 519 |
+
|
| 520 |
+
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.
|
| 521 |
+
|
| 522 |
+
|
| 523 |
+
## Broader Implications
|
| 524 |
+
|
| 525 |
+
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.
|
| 526 |
+
|
| 527 |
+
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.
|
| 528 |
+
|
| 529 |
+
|
| 530 |
+
### BibTeX entry and citation info
|
| 531 |
+
```bibtex
|
| 532 |
+
@misc{radford2022whisper,
|
| 533 |
+
doi = {10.48550/ARXIV.2212.04356},
|
| 534 |
+
url = {https://arxiv.org/abs/2212.04356},
|
| 535 |
+
author = {Radford, Alec and Kim, Jong Wook and Xu, Tao and Brockman, Greg and McLeavey, Christine and Sutskever, Ilya},
|
| 536 |
+
title = {Robust Speech Recognition via Large-Scale Weak Supervision},
|
| 537 |
+
publisher = {arXiv},
|
| 538 |
+
year = {2022},
|
| 539 |
+
copyright = {arXiv.org perpetual, non-exclusive license}
|
| 540 |
+
}
|
| 541 |
+
```
|
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+
50260,
|
| 47 |
+
50261,
|
| 48 |
+
50262,
|
| 49 |
+
50263,
|
| 50 |
+
50264,
|
| 51 |
+
50265,
|
| 52 |
+
50266,
|
| 53 |
+
50267,
|
| 54 |
+
50268,
|
| 55 |
+
50269,
|
| 56 |
+
50270,
|
| 57 |
+
50271,
|
| 58 |
+
50272,
|
| 59 |
+
50273,
|
| 60 |
+
50274,
|
| 61 |
+
50275,
|
| 62 |
+
50276,
|
| 63 |
+
50277,
|
| 64 |
+
50278,
|
| 65 |
+
50279,
|
| 66 |
+
50280,
|
| 67 |
+
50281,
|
| 68 |
+
50282,
|
| 69 |
+
50283,
|
| 70 |
+
50284,
|
| 71 |
+
50285,
|
| 72 |
+
50286,
|
| 73 |
+
50287,
|
| 74 |
+
50288,
|
| 75 |
+
50289,
|
| 76 |
+
50290,
|
| 77 |
+
50291,
|
| 78 |
+
50292,
|
| 79 |
+
50293,
|
| 80 |
+
50294,
|
| 81 |
+
50295,
|
| 82 |
+
50296,
|
| 83 |
+
50297,
|
| 84 |
+
50298,
|
| 85 |
+
50299,
|
| 86 |
+
50300,
|
| 87 |
+
50301,
|
| 88 |
+
50302,
|
| 89 |
+
50303,
|
| 90 |
+
50304,
|
| 91 |
+
50305,
|
| 92 |
+
50306,
|
| 93 |
+
50307,
|
| 94 |
+
50308,
|
| 95 |
+
50309,
|
| 96 |
+
50310,
|
| 97 |
+
50311,
|
| 98 |
+
50312,
|
| 99 |
+
50313,
|
| 100 |
+
50314,
|
| 101 |
+
50315,
|
| 102 |
+
50316,
|
| 103 |
+
50317,
|
| 104 |
+
50318,
|
| 105 |
+
50319,
|
| 106 |
+
50320,
|
| 107 |
+
50321,
|
| 108 |
+
50322,
|
| 109 |
+
50323,
|
| 110 |
+
50324,
|
| 111 |
+
50325,
|
| 112 |
+
50326,
|
| 113 |
+
50327,
|
| 114 |
+
50328,
|
| 115 |
+
50329,
|
| 116 |
+
50330,
|
| 117 |
+
50331,
|
| 118 |
+
50332,
|
| 119 |
+
50333,
|
| 120 |
+
50334,
|
| 121 |
+
50335,
|
| 122 |
+
50336,
|
| 123 |
+
50337,
|
| 124 |
+
50338,
|
| 125 |
+
50339,
|
| 126 |
+
50340,
|
| 127 |
+
50341,
|
| 128 |
+
50342,
|
| 129 |
+
50343,
|
| 130 |
+
50344,
|
| 131 |
+
50345,
|
| 132 |
+
50346,
|
| 133 |
+
50347,
|
| 134 |
+
50348,
|
| 135 |
+
50349,
|
| 136 |
+
50350,
|
| 137 |
+
50351,
|
| 138 |
+
50352,
|
| 139 |
+
50353,
|
| 140 |
+
50354,
|
| 141 |
+
50355,
|
| 142 |
+
50356,
|
| 143 |
+
50357,
|
| 144 |
+
50358
|
| 145 |
+
],
|
| 146 |
+
"suppress_ids": [
|
| 147 |
+
1,
|
| 148 |
+
2,
|
| 149 |
+
7,
|
| 150 |
+
8,
|
| 151 |
+
9,
|
| 152 |
+
10,
|
| 153 |
+
14,
|
| 154 |
+
25,
|
| 155 |
+
26,
|
| 156 |
+
27,
|
| 157 |
+
28,
|
| 158 |
+
29,
|
| 159 |
+
31,
|
| 160 |
+
58,
|
| 161 |
+
59,
|
| 162 |
+
60,
|
| 163 |
+
61,
|
| 164 |
+
62,
|
| 165 |
+
63,
|
| 166 |
+
90,
|
| 167 |
+
91,
|
| 168 |
+
92,
|
| 169 |
+
93,
|
| 170 |
+
359,
|
| 171 |
+
503,
|
| 172 |
+
522,
|
| 173 |
+
542,
|
| 174 |
+
873,
|
| 175 |
+
893,
|
| 176 |
+
902,
|
| 177 |
+
918,
|
| 178 |
+
922,
|
| 179 |
+
931,
|
| 180 |
+
1350,
|
| 181 |
+
1853,
|
| 182 |
+
1982,
|
| 183 |
+
2460,
|
| 184 |
+
2627,
|
| 185 |
+
3246,
|
| 186 |
+
3253,
|
| 187 |
+
3268,
|
| 188 |
+
3536,
|
| 189 |
+
3846,
|
| 190 |
+
3961,
|
| 191 |
+
4183,
|
| 192 |
+
4667,
|
| 193 |
+
6585,
|
| 194 |
+
6647,
|
| 195 |
+
7273,
|
| 196 |
+
9061,
|
| 197 |
+
9383,
|
| 198 |
+
10428,
|
| 199 |
+
10929,
|
| 200 |
+
11938,
|
| 201 |
+
12033,
|
| 202 |
+
12331,
|
| 203 |
+
12562,
|
| 204 |
+
13793,
|
| 205 |
+
14157,
|
| 206 |
+
14635,
|
| 207 |
+
15265,
|
| 208 |
+
15618,
|
| 209 |
+
16553,
|
| 210 |
+
16604,
|
| 211 |
+
18362,
|
| 212 |
+
18956,
|
| 213 |
+
20075,
|
| 214 |
+
21675,
|
| 215 |
+
22520,
|
| 216 |
+
26130,
|
| 217 |
+
26161,
|
| 218 |
+
26435,
|
| 219 |
+
28279,
|
| 220 |
+
29464,
|
| 221 |
+
31650,
|
| 222 |
+
32302,
|
| 223 |
+
32470,
|
| 224 |
+
36865,
|
| 225 |
+
42863,
|
| 226 |
+
47425,
|
| 227 |
+
49870,
|
| 228 |
+
50254,
|
| 229 |
+
50258,
|
| 230 |
+
50359,
|
| 231 |
+
50360,
|
| 232 |
+
50361,
|
| 233 |
+
50362,
|
| 234 |
+
50363
|
| 235 |
+
],
|
| 236 |
+
"suppress_ids_begin": [
|
| 237 |
+
220,
|
| 238 |
+
50257
|
| 239 |
+
]
|
| 240 |
+
}
|
model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:848492c4812ccee4256ef8a954981dc2a15fad16b2c807056dff20548afe5e3c
|
| 3 |
+
size 1558949857
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"chunk_length": 30,
|
| 3 |
+
"feature_extractor_type": "WhisperFeatureExtractor",
|
| 4 |
+
"feature_size": 128,
|
| 5 |
+
"hop_length": 160,
|
| 6 |
+
"n_fft": 400,
|
| 7 |
+
"n_samples": 480000,
|
| 8 |
+
"nb_max_frames": 3000,
|
| 9 |
+
"padding_side": "right",
|
| 10 |
+
"padding_value": 0.0,
|
| 11 |
+
"processor_class": "WhisperProcessor",
|
| 12 |
+
"return_attention_mask": false,
|
| 13 |
+
"sampling_rate": 16000
|
| 14 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
vocabulary.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|