Upload WhisperForConditionalGeneration
Browse files- README.md +3 -79
- config.json +61 -0
- generation_config.json +250 -0
- model.safetensors +3 -0
README.md
CHANGED
@@ -1,79 +1,3 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
4 |
-
datasets:
|
5 |
-
- NhutP/VSV-1100
|
6 |
-
- mozilla-foundation/common_voice_14_0
|
7 |
-
- AILAB-VNUHCM/vivos
|
8 |
-
language:
|
9 |
-
- vi
|
10 |
-
metrics:
|
11 |
-
- wer
|
12 |
-
base_model:
|
13 |
-
- openai/whisper-medium
|
14 |
-
---
|
15 |
-
## Introduction
|
16 |
-
- We release a new model for Vietnamese speech regconition task.
|
17 |
-
- We fine-tuned [openai/whisper-medium](https://huggingface.co/openai/whisper-medium) on our new dataset [VSV-1100](https://huggingface.co/datasets/NhutP/VSV-1100).
|
18 |
-
|
19 |
-
## Training data
|
20 |
-
|
21 |
-
| [VSV-1100](https://huggingface.co/datasets/NhutP/VSV-1100) | T2S* | [CMV14-vi](https://huggingface.co/datasets/mozilla-foundation/common_voice_14_0) |[VIVOS](https://huggingface.co/datasets/AILAB-VNUHCM/vivos)| [VLSP2021](https://vlsp.org.vn/index.php/resources) | Total|
|
22 |
-
|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|
|
23 |
-
| 1100 hours | 11 hours | 3.04 hours | 13.94 hours| 180 hours | 1308 hours |
|
24 |
-
|
25 |
-
\* We use a text-to-speech model to generate sentences containing words that do not appear in our dataset.
|
26 |
-
|
27 |
-
## WER result
|
28 |
-
| [CMV14-vi](https://huggingface.co/datasets/mozilla-foundation/common_voice_14_0) | [VIVOS](https://huggingface.co/datasets/AILAB-VNUHCM/vivos) | [VLSP2020-T1](https://vlsp.org.vn/index.php/resources) | [VLSP2020-T2](https://vlsp.org.vn/index.php/resources) | [VLSP2021-T1](https://vlsp.org.vn/index.php/resources) | [VLSP2021-T2](https://vlsp.org.vn/index.php/resources) |[Bud500](https://huggingface.co/datasets/linhtran92/viet_bud500) |
|
29 |
-
|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|
|
30 |
-
|8.1|4.69|13.22|28.76| 11.78 | 8.28 | 5.38 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
## Usage
|
35 |
-
### Inference
|
36 |
-
```python
|
37 |
-
from transformers import WhisperProcessor, WhisperForConditionalGeneration
|
38 |
-
import librosa
|
39 |
-
# load model and processor
|
40 |
-
processor = WhisperProcessor.from_pretrained("NhutP/ViWhisper-medium")
|
41 |
-
model = WhisperForConditionalGeneration.from_pretrained("NhutP/ViWhisper-medium")
|
42 |
-
model.config.forced_decoder_ids = None
|
43 |
-
|
44 |
-
# load a sample
|
45 |
-
array, sampling_rate = librosa.load('path_to_audio', sr = 16000) # Load some audio sample
|
46 |
-
input_features = processor(array, sampling_rate=sampling_rate, return_tensors="pt").input_features
|
47 |
-
# generate token ids
|
48 |
-
predicted_ids = model.generate(input_features)
|
49 |
-
# decode token ids to text
|
50 |
-
transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)
|
51 |
-
```
|
52 |
-
### Use with pipeline
|
53 |
-
```python
|
54 |
-
from transformers import pipeline
|
55 |
-
pipe = pipeline(
|
56 |
-
"automatic-speech-recognition",
|
57 |
-
model="NhutP/ViWhisper-medium",
|
58 |
-
max_new_tokens=128,
|
59 |
-
chunk_length_s=30,
|
60 |
-
return_timestamps=False,
|
61 |
-
device= '...' # 'cpu' or 'cuda'
|
62 |
-
)
|
63 |
-
output = pipe(path_to_audio_samplingrate_16000)['text']
|
64 |
-
```
|
65 |
-
|
66 |
-
## Citation
|
67 |
-
|
68 |
-
```
|
69 |
-
@misc{VSV-1100,
|
70 |
-
author = {Pham Quang Nhut and Duong Pham Hoang Anh and Nguyen Vinh Tiep},
|
71 |
-
title = {VSV-1100: Vietnamese social voice dataset},
|
72 |
-
url = {https://github.com/NhutP/VSV-1100},
|
73 |
-
year = {2024}
|
74 |
-
}
|
75 |
-
```
|
76 |
-
|
77 |
-
Also, please give us a star on github: https://github.com/NhutP/ViWhisper if you find our project useful
|
78 |
-
|
79 |
-
Contact me at: [email protected] (Pham Quang Nhut)
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config.json
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "C:\\Users\\quang\\Desktop\\eval_medium\\checkpoint-95368",
|
3 |
+
"activation_dropout": 0.0,
|
4 |
+
"activation_function": "gelu",
|
5 |
+
"apply_spec_augment": false,
|
6 |
+
"architectures": [
|
7 |
+
"WhisperForConditionalGeneration"
|
8 |
+
],
|
9 |
+
"attention_dropout": 0.0,
|
10 |
+
"begin_suppress_tokens": null,
|
11 |
+
"bos_token_id": 50257,
|
12 |
+
"classifier_proj_size": 256,
|
13 |
+
"d_model": 1024,
|
14 |
+
"decoder_attention_heads": 16,
|
15 |
+
"decoder_ffn_dim": 4096,
|
16 |
+
"decoder_layerdrop": 0.0,
|
17 |
+
"decoder_layers": 24,
|
18 |
+
"decoder_start_token_id": 50258,
|
19 |
+
"dropout": 0.0,
|
20 |
+
"encoder_attention_heads": 16,
|
21 |
+
"encoder_ffn_dim": 4096,
|
22 |
+
"encoder_layerdrop": 0.0,
|
23 |
+
"encoder_layers": 24,
|
24 |
+
"eos_token_id": 50257,
|
25 |
+
"forced_decoder_ids": [
|
26 |
+
[
|
27 |
+
1,
|
28 |
+
50259
|
29 |
+
],
|
30 |
+
[
|
31 |
+
2,
|
32 |
+
50359
|
33 |
+
],
|
34 |
+
[
|
35 |
+
3,
|
36 |
+
50363
|
37 |
+
]
|
38 |
+
],
|
39 |
+
"init_std": 0.02,
|
40 |
+
"is_encoder_decoder": true,
|
41 |
+
"mask_feature_length": 10,
|
42 |
+
"mask_feature_min_masks": 0,
|
43 |
+
"mask_feature_prob": 0.0,
|
44 |
+
"mask_time_length": 10,
|
45 |
+
"mask_time_min_masks": 2,
|
46 |
+
"mask_time_prob": 0.05,
|
47 |
+
"max_length": null,
|
48 |
+
"max_source_positions": 1500,
|
49 |
+
"max_target_positions": 448,
|
50 |
+
"median_filter_width": 7,
|
51 |
+
"model_type": "whisper",
|
52 |
+
"num_hidden_layers": 24,
|
53 |
+
"num_mel_bins": 80,
|
54 |
+
"pad_token_id": 50257,
|
55 |
+
"scale_embedding": false,
|
56 |
+
"torch_dtype": "float32",
|
57 |
+
"transformers_version": "4.38.2",
|
58 |
+
"use_cache": false,
|
59 |
+
"use_weighted_layer_sum": false,
|
60 |
+
"vocab_size": 51865
|
61 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
20 |
+
20,
|
21 |
+
0
|
22 |
+
],
|
23 |
+
[
|
24 |
+
23,
|
25 |
+
4
|
26 |
+
]
|
27 |
+
],
|
28 |
+
"begin_suppress_tokens": [
|
29 |
+
220,
|
30 |
+
50257
|
31 |
+
],
|
32 |
+
"bos_token_id": 50257,
|
33 |
+
"decoder_start_token_id": 50258,
|
34 |
+
"eos_token_id": 50257,
|
35 |
+
"forced_decoder_ids": [
|
36 |
+
[
|
37 |
+
1,
|
38 |
+
null
|
39 |
+
],
|
40 |
+
[
|
41 |
+
2,
|
42 |
+
50359
|
43 |
+
]
|
44 |
+
],
|
45 |
+
"is_multilingual": true,
|
46 |
+
"lang_to_id": {
|
47 |
+
"<|af|>": 50327,
|
48 |
+
"<|am|>": 50334,
|
49 |
+
"<|ar|>": 50272,
|
50 |
+
"<|as|>": 50350,
|
51 |
+
"<|az|>": 50304,
|
52 |
+
"<|ba|>": 50355,
|
53 |
+
"<|be|>": 50330,
|
54 |
+
"<|bg|>": 50292,
|
55 |
+
"<|bn|>": 50302,
|
56 |
+
"<|bo|>": 50347,
|
57 |
+
"<|br|>": 50309,
|
58 |
+
"<|bs|>": 50315,
|
59 |
+
"<|ca|>": 50270,
|
60 |
+
"<|cs|>": 50283,
|
61 |
+
"<|cy|>": 50297,
|
62 |
+
"<|da|>": 50285,
|
63 |
+
"<|de|>": 50261,
|
64 |
+
"<|el|>": 50281,
|
65 |
+
"<|en|>": 50259,
|
66 |
+
"<|es|>": 50262,
|
67 |
+
"<|et|>": 50307,
|
68 |
+
"<|eu|>": 50310,
|
69 |
+
"<|fa|>": 50300,
|
70 |
+
"<|fi|>": 50277,
|
71 |
+
"<|fo|>": 50338,
|
72 |
+
"<|fr|>": 50265,
|
73 |
+
"<|gl|>": 50319,
|
74 |
+
"<|gu|>": 50333,
|
75 |
+
"<|haw|>": 50352,
|
76 |
+
"<|ha|>": 50354,
|
77 |
+
"<|he|>": 50279,
|
78 |
+
"<|hi|>": 50276,
|
79 |
+
"<|hr|>": 50291,
|
80 |
+
"<|ht|>": 50339,
|
81 |
+
"<|hu|>": 50286,
|
82 |
+
"<|hy|>": 50312,
|
83 |
+
"<|id|>": 50275,
|
84 |
+
"<|is|>": 50311,
|
85 |
+
"<|it|>": 50274,
|
86 |
+
"<|ja|>": 50266,
|
87 |
+
"<|jw|>": 50356,
|
88 |
+
"<|ka|>": 50329,
|
89 |
+
"<|kk|>": 50316,
|
90 |
+
"<|km|>": 50323,
|
91 |
+
"<|kn|>": 50306,
|
92 |
+
"<|ko|>": 50264,
|
93 |
+
"<|la|>": 50294,
|
94 |
+
"<|lb|>": 50345,
|
95 |
+
"<|ln|>": 50353,
|
96 |
+
"<|lo|>": 50336,
|
97 |
+
"<|lt|>": 50293,
|
98 |
+
"<|lv|>": 50301,
|
99 |
+
"<|mg|>": 50349,
|
100 |
+
"<|mi|>": 50295,
|
101 |
+
"<|mk|>": 50308,
|
102 |
+
"<|ml|>": 50296,
|
103 |
+
"<|mn|>": 50314,
|
104 |
+
"<|mr|>": 50320,
|
105 |
+
"<|ms|>": 50282,
|
106 |
+
"<|mt|>": 50343,
|
107 |
+
"<|my|>": 50346,
|
108 |
+
"<|ne|>": 50313,
|
109 |
+
"<|nl|>": 50271,
|
110 |
+
"<|nn|>": 50342,
|
111 |
+
"<|no|>": 50288,
|
112 |
+
"<|oc|>": 50328,
|
113 |
+
"<|pa|>": 50321,
|
114 |
+
"<|pl|>": 50269,
|
115 |
+
"<|ps|>": 50340,
|
116 |
+
"<|pt|>": 50267,
|
117 |
+
"<|ro|>": 50284,
|
118 |
+
"<|ru|>": 50263,
|
119 |
+
"<|sa|>": 50344,
|
120 |
+
"<|sd|>": 50332,
|
121 |
+
"<|si|>": 50322,
|
122 |
+
"<|sk|>": 50298,
|
123 |
+
"<|sl|>": 50305,
|
124 |
+
"<|sn|>": 50324,
|
125 |
+
"<|so|>": 50326,
|
126 |
+
"<|sq|>": 50317,
|
127 |
+
"<|sr|>": 50303,
|
128 |
+
"<|su|>": 50357,
|
129 |
+
"<|sv|>": 50273,
|
130 |
+
"<|sw|>": 50318,
|
131 |
+
"<|ta|>": 50287,
|
132 |
+
"<|te|>": 50299,
|
133 |
+
"<|tg|>": 50331,
|
134 |
+
"<|th|>": 50289,
|
135 |
+
"<|tk|>": 50341,
|
136 |
+
"<|tl|>": 50348,
|
137 |
+
"<|tr|>": 50268,
|
138 |
+
"<|tt|>": 50351,
|
139 |
+
"<|uk|>": 50280,
|
140 |
+
"<|ur|>": 50290,
|
141 |
+
"<|uz|>": 50337,
|
142 |
+
"<|vi|>": 50278,
|
143 |
+
"<|yi|>": 50335,
|
144 |
+
"<|yo|>": 50325,
|
145 |
+
"<|zh|>": 50260
|
146 |
+
},
|
147 |
+
"language": "vi",
|
148 |
+
"max_initial_timestamp_index": 50,
|
149 |
+
"max_length": 448,
|
150 |
+
"no_timestamps_token_id": 50363,
|
151 |
+
"pad_token_id": 50257,
|
152 |
+
"prev_sot_token_id": 50361,
|
153 |
+
"return_timestamps": false,
|
154 |
+
"suppress_tokens": [
|
155 |
+
1,
|
156 |
+
2,
|
157 |
+
7,
|
158 |
+
8,
|
159 |
+
9,
|
160 |
+
10,
|
161 |
+
14,
|
162 |
+
25,
|
163 |
+
26,
|
164 |
+
27,
|
165 |
+
28,
|
166 |
+
29,
|
167 |
+
31,
|
168 |
+
58,
|
169 |
+
59,
|
170 |
+
60,
|
171 |
+
61,
|
172 |
+
62,
|
173 |
+
63,
|
174 |
+
90,
|
175 |
+
91,
|
176 |
+
92,
|
177 |
+
93,
|
178 |
+
359,
|
179 |
+
503,
|
180 |
+
522,
|
181 |
+
542,
|
182 |
+
873,
|
183 |
+
893,
|
184 |
+
902,
|
185 |
+
918,
|
186 |
+
922,
|
187 |
+
931,
|
188 |
+
1350,
|
189 |
+
1853,
|
190 |
+
1982,
|
191 |
+
2460,
|
192 |
+
2627,
|
193 |
+
3246,
|
194 |
+
3253,
|
195 |
+
3268,
|
196 |
+
3536,
|
197 |
+
3846,
|
198 |
+
3961,
|
199 |
+
4183,
|
200 |
+
4667,
|
201 |
+
6585,
|
202 |
+
6647,
|
203 |
+
7273,
|
204 |
+
9061,
|
205 |
+
9383,
|
206 |
+
10428,
|
207 |
+
10929,
|
208 |
+
11938,
|
209 |
+
12033,
|
210 |
+
12331,
|
211 |
+
12562,
|
212 |
+
13793,
|
213 |
+
14157,
|
214 |
+
14635,
|
215 |
+
15265,
|
216 |
+
15618,
|
217 |
+
16553,
|
218 |
+
16604,
|
219 |
+
18362,
|
220 |
+
18956,
|
221 |
+
20075,
|
222 |
+
21675,
|
223 |
+
22520,
|
224 |
+
26130,
|
225 |
+
26161,
|
226 |
+
26435,
|
227 |
+
28279,
|
228 |
+
29464,
|
229 |
+
31650,
|
230 |
+
32302,
|
231 |
+
32470,
|
232 |
+
36865,
|
233 |
+
42863,
|
234 |
+
47425,
|
235 |
+
49870,
|
236 |
+
50254,
|
237 |
+
50258,
|
238 |
+
50358,
|
239 |
+
50359,
|
240 |
+
50360,
|
241 |
+
50361,
|
242 |
+
50362
|
243 |
+
],
|
244 |
+
"task_to_id": {
|
245 |
+
"transcribe": 50359,
|
246 |
+
"translate": 50358
|
247 |
+
},
|
248 |
+
"transformers_version": "4.38.2",
|
249 |
+
"use_cache": false
|
250 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:84459b728f973ff4585d12242ace01ececfb68235964ad6a0f122e709c6aeab5
|
3 |
+
size 3055544304
|