mariagrandury commited on
Commit
69128c5
1 Parent(s): b8db3fd

Configure model and feature extractor

Browse files
Files changed (3) hide show
  1. config.json +85 -0
  2. config.py +21 -0
  3. preprocessor_config.json +9 -0
config.json ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_dropout": 0.0,
3
+ "apply_spec_augment": true,
4
+ "architectures": [
5
+ "Wav2Vec2ForPreTraining"
6
+ ],
7
+ "attention_dropout": 0.1,
8
+ "bos_token_id": 1,
9
+ "codevector_dim": 256,
10
+ "contrastive_logits_temperature": 0.1,
11
+ "conv_bias": false,
12
+ "conv_dim": [
13
+ 512,
14
+ 512,
15
+ 512,
16
+ 512,
17
+ 512,
18
+ 512,
19
+ 512
20
+ ],
21
+ "conv_kernel": [
22
+ 10,
23
+ 3,
24
+ 3,
25
+ 3,
26
+ 3,
27
+ 2,
28
+ 2
29
+ ],
30
+ "conv_stride": [
31
+ 5,
32
+ 2,
33
+ 2,
34
+ 2,
35
+ 2,
36
+ 2,
37
+ 2
38
+ ],
39
+ "ctc_loss_reduction": "sum",
40
+ "ctc_zero_infinity": false,
41
+ "diversity_loss_weight": 0.1,
42
+ "do_stable_layer_norm": true,
43
+ "eos_token_id": 2,
44
+ "feat_extract_activation": "gelu",
45
+ "feat_extract_norm": "layer",
46
+ "feat_proj_dropout": 0.1,
47
+ "feat_quantizer_dropout": 0.0,
48
+ "final_dropout": 0.0,
49
+ "freeze_feat_extract_train": true,
50
+ "gradient_checkpointing": true,
51
+ "hidden_act": "gelu",
52
+ "hidden_dropout": 0.1,
53
+ "hidden_size": 768,
54
+ "initializer_range": 0.02,
55
+ "intermediate_size": 3072,
56
+ "layer_norm_eps": 1e-05,
57
+ "layerdrop": 0.05,
58
+ "mask_channel_length": 10,
59
+ "mask_channel_min_space": 1,
60
+ "mask_channel_other": 0.0,
61
+ "mask_channel_prob": 0.0,
62
+ "mask_channel_selection": "static",
63
+ "mask_feature_length": 10,
64
+ "mask_feature_prob": 0.0,
65
+ "mask_time_length": 10,
66
+ "mask_time_min_space": 1,
67
+ "mask_time_other": 0.0,
68
+ "mask_time_prob": 0.05,
69
+ "mask_time_selection": "static",
70
+ "model_type": "wav2vec2",
71
+ "no_mask_channel_overlap": false,
72
+ "no_mask_time_overlap": false,
73
+ "num_attention_heads": 12,
74
+ "num_codevector_groups": 2,
75
+ "num_codevectors_per_group": 320,
76
+ "num_conv_pos_embedding_groups": 16,
77
+ "num_conv_pos_embeddings": 128,
78
+ "num_feat_extract_layers": 7,
79
+ "num_hidden_layers": 12,
80
+ "num_negatives": 100,
81
+ "pad_token_id": 0,
82
+ "proj_codevector_dim": 256,
83
+ "transformers_version": "4.9.0.dev0",
84
+ "vocab_size": 32
85
+ }
config.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Create the model configuration (`config.json`) and the feature extractor configuration
3
+ (`preprocessor_config.json`).
4
+ """
5
+ from transformers import Wav2Vec2Config, Wav2Vec2FeatureExtractor
6
+
7
+ model_dir="./"
8
+
9
+ config = Wav2Vec2Config.from_pretrained(
10
+ "facebook/wav2vec2-base",
11
+ mask_time_length=10,
12
+ mask_time_prob=0.05,
13
+ diversity_loss_weight=0.1,
14
+ num_negatives=100,
15
+ do_stable_layer_norm=True,
16
+ feat_extract_norm="layer",
17
+ )
18
+ config.save_pretrained(model_dir)
19
+
20
+ config = Wav2Vec2FeatureExtractor.from_pretrained("facebook/wav2vec2-base", return_attention_mask=True)
21
+ config.save_pretrained(model_dir)
preprocessor_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_normalize": true,
3
+ "feature_extractor_type": "Wav2Vec2FeatureExtractor",
4
+ "feature_size": 1,
5
+ "padding_side": "right",
6
+ "padding_value": 0.0,
7
+ "return_attention_mask": true,
8
+ "sampling_rate": 16000
9
+ }