cromz22
commited on
Commit
•
3665b39
1
Parent(s):
aed331f
upload model files
Browse files- config.json +293 -0
- load_and_save.py +35 -0
- merges.txt +0 -0
- preprocessor_config.json +10 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tokenizer.json +0 -0
- tokenizer_config.json +1 -0
- vocab.json +0 -0
config.json
ADDED
@@ -0,0 +1,293 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"SpeechEncoderDecoderModel"
|
4 |
+
],
|
5 |
+
"decoder": {
|
6 |
+
"_name_or_path": "facebook/bart-base",
|
7 |
+
"activation_dropout": 0.1,
|
8 |
+
"activation_function": "gelu",
|
9 |
+
"add_bias_logits": false,
|
10 |
+
"add_cross_attention": true,
|
11 |
+
"add_final_layer_norm": false,
|
12 |
+
"architectures": [
|
13 |
+
"BartModel"
|
14 |
+
],
|
15 |
+
"attention_dropout": 0.1,
|
16 |
+
"bad_words_ids": null,
|
17 |
+
"bos_token_id": 0,
|
18 |
+
"chunk_size_feed_forward": 0,
|
19 |
+
"classif_dropout": 0.1,
|
20 |
+
"classifier_dropout": 0.0,
|
21 |
+
"cross_attention_hidden_size": null,
|
22 |
+
"d_model": 768,
|
23 |
+
"decoder_attention_heads": 12,
|
24 |
+
"decoder_ffn_dim": 3072,
|
25 |
+
"decoder_layerdrop": 0.0,
|
26 |
+
"decoder_layers": 6,
|
27 |
+
"decoder_start_token_id": 2,
|
28 |
+
"diversity_penalty": 0.0,
|
29 |
+
"do_sample": false,
|
30 |
+
"dropout": 0.1,
|
31 |
+
"early_stopping": true,
|
32 |
+
"encoder_attention_heads": 12,
|
33 |
+
"encoder_ffn_dim": 3072,
|
34 |
+
"encoder_layerdrop": 0.0,
|
35 |
+
"encoder_layers": 6,
|
36 |
+
"encoder_no_repeat_ngram_size": 0,
|
37 |
+
"eos_token_id": 2,
|
38 |
+
"exponential_decay_length_penalty": null,
|
39 |
+
"finetuning_task": null,
|
40 |
+
"forced_bos_token_id": 0,
|
41 |
+
"forced_eos_token_id": 2,
|
42 |
+
"gradient_checkpointing": false,
|
43 |
+
"id2label": {
|
44 |
+
"0": "LABEL_0",
|
45 |
+
"1": "LABEL_1",
|
46 |
+
"2": "LABEL_2"
|
47 |
+
},
|
48 |
+
"init_std": 0.02,
|
49 |
+
"is_decoder": true,
|
50 |
+
"is_encoder_decoder": false,
|
51 |
+
"label2id": {
|
52 |
+
"LABEL_0": 0,
|
53 |
+
"LABEL_1": 1,
|
54 |
+
"LABEL_2": 2
|
55 |
+
},
|
56 |
+
"length_penalty": 1.0,
|
57 |
+
"max_length": 20,
|
58 |
+
"max_position_embeddings": 1024,
|
59 |
+
"min_length": 0,
|
60 |
+
"model_type": "bart",
|
61 |
+
"no_repeat_ngram_size": 3,
|
62 |
+
"normalize_before": false,
|
63 |
+
"normalize_embedding": true,
|
64 |
+
"num_beam_groups": 1,
|
65 |
+
"num_beams": 4,
|
66 |
+
"num_hidden_layers": 6,
|
67 |
+
"num_return_sequences": 1,
|
68 |
+
"output_attentions": false,
|
69 |
+
"output_hidden_states": false,
|
70 |
+
"output_scores": false,
|
71 |
+
"pad_token_id": 1,
|
72 |
+
"prefix": null,
|
73 |
+
"problem_type": null,
|
74 |
+
"pruned_heads": {},
|
75 |
+
"remove_invalid_values": false,
|
76 |
+
"repetition_penalty": 1.0,
|
77 |
+
"return_dict": true,
|
78 |
+
"return_dict_in_generate": false,
|
79 |
+
"scale_embedding": false,
|
80 |
+
"sep_token_id": null,
|
81 |
+
"task_specific_params": {
|
82 |
+
"summarization": {
|
83 |
+
"length_penalty": 1.0,
|
84 |
+
"max_length": 128,
|
85 |
+
"min_length": 12,
|
86 |
+
"num_beams": 4
|
87 |
+
},
|
88 |
+
"summarization_cnn": {
|
89 |
+
"length_penalty": 2.0,
|
90 |
+
"max_length": 142,
|
91 |
+
"min_length": 56,
|
92 |
+
"num_beams": 4
|
93 |
+
},
|
94 |
+
"summarization_xsum": {
|
95 |
+
"length_penalty": 1.0,
|
96 |
+
"max_length": 62,
|
97 |
+
"min_length": 11,
|
98 |
+
"num_beams": 6
|
99 |
+
}
|
100 |
+
},
|
101 |
+
"temperature": 1.0,
|
102 |
+
"tie_encoder_decoder": false,
|
103 |
+
"tie_word_embeddings": true,
|
104 |
+
"tokenizer_class": null,
|
105 |
+
"top_k": 50,
|
106 |
+
"top_p": 1.0,
|
107 |
+
"torch_dtype": "float32",
|
108 |
+
"torchscript": false,
|
109 |
+
"transformers_version": "4.20.0.dev0",
|
110 |
+
"typical_p": 1.0,
|
111 |
+
"use_bfloat16": false,
|
112 |
+
"use_cache": true,
|
113 |
+
"vocab_size": 50265
|
114 |
+
},
|
115 |
+
"decoder_start_token_id": 0,
|
116 |
+
"encoder": {
|
117 |
+
"_name_or_path": "facebook/wav2vec2-base",
|
118 |
+
"activation_dropout": 0.0,
|
119 |
+
"adapter_kernel_size": 3,
|
120 |
+
"adapter_stride": 2,
|
121 |
+
"add_adapter": true,
|
122 |
+
"add_cross_attention": false,
|
123 |
+
"apply_spec_augment": true,
|
124 |
+
"architectures": [
|
125 |
+
"Wav2Vec2ForPreTraining"
|
126 |
+
],
|
127 |
+
"attention_dropout": 0.1,
|
128 |
+
"bad_words_ids": null,
|
129 |
+
"bos_token_id": 1,
|
130 |
+
"chunk_size_feed_forward": 0,
|
131 |
+
"classifier_proj_size": 256,
|
132 |
+
"codevector_dim": 256,
|
133 |
+
"contrastive_logits_temperature": 0.1,
|
134 |
+
"conv_bias": false,
|
135 |
+
"conv_dim": [
|
136 |
+
512,
|
137 |
+
512,
|
138 |
+
512,
|
139 |
+
512,
|
140 |
+
512,
|
141 |
+
512,
|
142 |
+
512
|
143 |
+
],
|
144 |
+
"conv_kernel": [
|
145 |
+
10,
|
146 |
+
3,
|
147 |
+
3,
|
148 |
+
3,
|
149 |
+
3,
|
150 |
+
2,
|
151 |
+
2
|
152 |
+
],
|
153 |
+
"conv_stride": [
|
154 |
+
5,
|
155 |
+
2,
|
156 |
+
2,
|
157 |
+
2,
|
158 |
+
2,
|
159 |
+
2,
|
160 |
+
2
|
161 |
+
],
|
162 |
+
"cross_attention_hidden_size": null,
|
163 |
+
"ctc_loss_reduction": "sum",
|
164 |
+
"ctc_zero_infinity": false,
|
165 |
+
"decoder_start_token_id": null,
|
166 |
+
"diversity_loss_weight": 0.1,
|
167 |
+
"diversity_penalty": 0.0,
|
168 |
+
"do_sample": false,
|
169 |
+
"do_stable_layer_norm": false,
|
170 |
+
"early_stopping": false,
|
171 |
+
"encoder_no_repeat_ngram_size": 0,
|
172 |
+
"eos_token_id": 2,
|
173 |
+
"exponential_decay_length_penalty": null,
|
174 |
+
"feat_extract_activation": "gelu",
|
175 |
+
"feat_extract_norm": "group",
|
176 |
+
"feat_proj_dropout": 0.0,
|
177 |
+
"feat_quantizer_dropout": 0.0,
|
178 |
+
"final_dropout": 0.0,
|
179 |
+
"finetuning_task": null,
|
180 |
+
"forced_bos_token_id": null,
|
181 |
+
"forced_eos_token_id": null,
|
182 |
+
"freeze_feat_extract_train": true,
|
183 |
+
"hidden_act": "gelu",
|
184 |
+
"hidden_dropout": 0.1,
|
185 |
+
"hidden_size": 768,
|
186 |
+
"id2label": {
|
187 |
+
"0": "LABEL_0",
|
188 |
+
"1": "LABEL_1"
|
189 |
+
},
|
190 |
+
"initializer_range": 0.02,
|
191 |
+
"intermediate_size": 3072,
|
192 |
+
"is_decoder": false,
|
193 |
+
"is_encoder_decoder": false,
|
194 |
+
"label2id": {
|
195 |
+
"LABEL_0": 0,
|
196 |
+
"LABEL_1": 1
|
197 |
+
},
|
198 |
+
"layer_norm_eps": 1e-05,
|
199 |
+
"layerdrop": 0.0,
|
200 |
+
"length_penalty": 1.0,
|
201 |
+
"mask_channel_length": 10,
|
202 |
+
"mask_channel_min_space": 1,
|
203 |
+
"mask_channel_other": 0.0,
|
204 |
+
"mask_channel_prob": 0.0,
|
205 |
+
"mask_channel_selection": "static",
|
206 |
+
"mask_feature_length": 10,
|
207 |
+
"mask_feature_min_masks": 0,
|
208 |
+
"mask_feature_prob": 0.0,
|
209 |
+
"mask_time_length": 10,
|
210 |
+
"mask_time_min_masks": 2,
|
211 |
+
"mask_time_min_space": 1,
|
212 |
+
"mask_time_other": 0.0,
|
213 |
+
"mask_time_prob": 0.05,
|
214 |
+
"mask_time_selection": "static",
|
215 |
+
"max_length": 20,
|
216 |
+
"min_length": 0,
|
217 |
+
"model_type": "wav2vec2",
|
218 |
+
"no_mask_channel_overlap": false,
|
219 |
+
"no_mask_time_overlap": false,
|
220 |
+
"no_repeat_ngram_size": 0,
|
221 |
+
"num_adapter_layers": 3,
|
222 |
+
"num_attention_heads": 12,
|
223 |
+
"num_beam_groups": 1,
|
224 |
+
"num_beams": 1,
|
225 |
+
"num_codevector_groups": 2,
|
226 |
+
"num_codevectors_per_group": 320,
|
227 |
+
"num_conv_pos_embedding_groups": 16,
|
228 |
+
"num_conv_pos_embeddings": 128,
|
229 |
+
"num_feat_extract_layers": 7,
|
230 |
+
"num_hidden_layers": 12,
|
231 |
+
"num_negatives": 100,
|
232 |
+
"num_return_sequences": 1,
|
233 |
+
"output_attentions": false,
|
234 |
+
"output_hidden_size": 768,
|
235 |
+
"output_hidden_states": false,
|
236 |
+
"output_scores": false,
|
237 |
+
"pad_token_id": 0,
|
238 |
+
"prefix": null,
|
239 |
+
"problem_type": null,
|
240 |
+
"proj_codevector_dim": 256,
|
241 |
+
"pruned_heads": {},
|
242 |
+
"remove_invalid_values": false,
|
243 |
+
"repetition_penalty": 1.0,
|
244 |
+
"return_dict": true,
|
245 |
+
"return_dict_in_generate": false,
|
246 |
+
"sep_token_id": null,
|
247 |
+
"task_specific_params": null,
|
248 |
+
"tdnn_dilation": [
|
249 |
+
1,
|
250 |
+
2,
|
251 |
+
3,
|
252 |
+
1,
|
253 |
+
1
|
254 |
+
],
|
255 |
+
"tdnn_dim": [
|
256 |
+
512,
|
257 |
+
512,
|
258 |
+
512,
|
259 |
+
512,
|
260 |
+
1500
|
261 |
+
],
|
262 |
+
"tdnn_kernel": [
|
263 |
+
5,
|
264 |
+
3,
|
265 |
+
3,
|
266 |
+
1,
|
267 |
+
1
|
268 |
+
],
|
269 |
+
"temperature": 1.0,
|
270 |
+
"tie_encoder_decoder": false,
|
271 |
+
"tie_word_embeddings": true,
|
272 |
+
"tokenizer_class": null,
|
273 |
+
"top_k": 50,
|
274 |
+
"top_p": 1.0,
|
275 |
+
"torch_dtype": null,
|
276 |
+
"torchscript": false,
|
277 |
+
"transformers_version": "4.20.0.dev0",
|
278 |
+
"typical_p": 1.0,
|
279 |
+
"use_bfloat16": false,
|
280 |
+
"use_weighted_layer_sum": false,
|
281 |
+
"vocab_size": 32,
|
282 |
+
"xvector_output_dim": 512
|
283 |
+
},
|
284 |
+
"eos_token_id": 2,
|
285 |
+
"is_encoder_decoder": true,
|
286 |
+
"max_length": 200,
|
287 |
+
"model_type": "speech-encoder-decoder",
|
288 |
+
"num_beams": 5,
|
289 |
+
"pad_token_id": 1,
|
290 |
+
"tie_word_embeddings": false,
|
291 |
+
"torch_dtype": "float32",
|
292 |
+
"transformers_version": null
|
293 |
+
}
|
load_and_save.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
|
3 |
+
# from transformers.utils.dummy_pt_objects import SpeechEncoderDecoderModel
|
4 |
+
# from transformers.models.auto.feature_extraction_auto import AutoFeatureExtractor
|
5 |
+
# from transformers.models.auto.tokenization_auto import AutoTokenizer
|
6 |
+
# from transformers.models.wav2vec2.processing_wav2vec2 import Wav2Vec2Processor
|
7 |
+
|
8 |
+
from transformers import SpeechEncoderDecoderModel, AutoFeatureExtractor, AutoTokenizer, Wav2Vec2Processor
|
9 |
+
|
10 |
+
|
11 |
+
# checkpoints to leverage
|
12 |
+
encoder_id = "facebook/wav2vec2-base"
|
13 |
+
decoder_id = "facebook/bart-base"
|
14 |
+
|
15 |
+
# load and save speech-encoder-decoder model
|
16 |
+
# set some hyper-parameters for training and evaluation
|
17 |
+
model = SpeechEncoderDecoderModel.from_encoder_decoder_pretrained(
|
18 |
+
encoder_id,
|
19 |
+
decoder_id,
|
20 |
+
encoder_add_adapter=True,
|
21 |
+
encoder_feat_proj_dropout=0.0,
|
22 |
+
encoder_layerdrop=0.0,
|
23 |
+
max_length=200,
|
24 |
+
num_beams=5,
|
25 |
+
)
|
26 |
+
model.config.decoder_start_token_id = model.decoder.config.bos_token_id
|
27 |
+
model.config.pad_token_id = model.decoder.config.pad_token_id
|
28 |
+
model.config.eos_token_id = model.decoder.config.eos_token_id
|
29 |
+
model.save_pretrained("./")
|
30 |
+
|
31 |
+
# load and save processor
|
32 |
+
feature_extractor = AutoFeatureExtractor.from_pretrained(encoder_id)
|
33 |
+
tokenizer = AutoTokenizer.from_pretrained(decoder_id)
|
34 |
+
processor = Wav2Vec2Processor(feature_extractor, tokenizer)
|
35 |
+
processor.save_pretrained("./")
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
preprocessor_config.json
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"do_normalize": true,
|
3 |
+
"feature_extractor_type": "Wav2Vec2FeatureExtractor",
|
4 |
+
"feature_size": 1,
|
5 |
+
"padding_side": "right",
|
6 |
+
"padding_value": 0.0,
|
7 |
+
"processor_class": "Wav2Vec2Processor",
|
8 |
+
"return_attention_mask": false,
|
9 |
+
"sampling_rate": 16000
|
10 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f8c5e3f1f9ce8bdd2393f46a380784072a9fd50a1d61f21cf5876956a712a79d
|
3 |
+
size 804509967
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "sep_token": "</s>", "pad_token": "<pad>", "cls_token": "<s>", "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": false}}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"errors": "replace", "bos_token": "<s>", "eos_token": "</s>", "sep_token": "</s>", "cls_token": "<s>", "unk_token": "<unk>", "pad_token": "<pad>", "mask_token": "<mask>", "add_prefix_space": false, "trim_offsets": true, "model_max_length": 1024, "special_tokens_map_file": null, "name_or_path": "facebook/bart-base", "tokenizer_class": "BartTokenizer", "processor_class": "Wav2Vec2Processor"}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|