Bagus Tris Atmaja commited on
Commit
e22822c
1 Parent(s): 39b4c14

upload model files

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