-
Notifications
You must be signed in to change notification settings - Fork 1
/
config_updates.py
266 lines (198 loc) · 7.06 KB
/
config_updates.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
from sacred import Ingredient
def add_configs(ex):
"""
This functions add generic configuration for the experiments, such as mix-up, architectures, etc...
"""
@ex.named_config
def mini_train():
"limit training/validation to 5 batches for debbuging."
trainer = dict(limit_train_batches=5, limit_val_batches=5)
datamodule = {"groundtruth_val": "discogs/gt_val_all_400l_super_clean.pk"}
# Experiments from
# EFFICIENT SUPERVISED TRAINING OF AUDIO TRANSFORMERS FOR MUSIC REPRESENTATION LEARNING
# Section 4.2. Impact of initial weights
########################################
# Pretraining settings
@ex.named_config
def maest_10s_random_weights_pretrain():
"time encodings for up to 10 seconds, and random initialization"
datamodule = {"clip_length": 10}
maest = {
"arch": "passt_s_swa_p16_128_ap476",
"pretrained": False,
"input_t": 10 * 16000 // 256,
"s_patchout_t": 30,
}
@ex.named_config
def maest_10s_from_deit_pretrain():
"time encodings for up to 10 seconds and initializaiton to the DeiT weights"
datamodule = {"clip_length": 10}
maest = {
"arch": "passt_deit_bd_p16_384",
"pretrained": True,
"input_t": 10 * 16000 // 256,
"s_patchout_t": 30,
}
@ex.named_config
def maest_10s_from_passt_pretrain():
"time encodings for up to 10 seconds and initializaiton to the PaSST weights"
datamodule = {"clip_length": 10}
maest = {
"arch": "passt_s_swa_p16_128_ap476",
"pretrained": True,
"input_t": 10 * 16000 // 256,
"s_patchout_t": 30,
}
# Inference settings
@ex.named_config
def maest_10s_random_weights_inference():
"time encodings for up to 10 seconds, and random initialization (from scratch)"
datamodule = {"clip_length": 10}
maest = {
"arch": "discogs-maest-10s-fs-129e",
"pretrained": True,
"input_t": 10 * 16000 // 256,
}
predict = {"transformer_block": 7}
@ex.named_config
def maest_10s_from_deit_inference():
"time encodings for up to 10 seconds and initializaiton to the DeiT weights"
datamodule = {"clip_length": 10}
maest = {
"arch": "discogs-maest-10s-dw-75e",
"pretrained": True,
"input_t": 10 * 16000 // 256,
}
predict = {"transformer_block": 7}
@ex.named_config
def maest_10s_from_passt_inference():
"time encodings for up to 10 seconds and initializaiton to the PaSST weights"
datamodule = {"clip_length": 10}
maest = {
"arch": "discogs-maest-10s-pw-129e",
"pretrained": True,
"input_t": 10 * 16000 // 256,
}
predict = {"transformer_block": 7}
# Section 4.3. Effect of the input sequence length
##################################################
# Pretraining settings
@ex.named_config
def maest_5s_from_passt_pretrain():
"time encodings for up to 5 seconds"
datamodule = {"clip_length": 5}
maest = {
"arch": "passt_s_swa_p16_128_ap476",
"pretrained": True,
"input_t": 5 * 16000 // 256,
"s_patchout_t": 30,
}
@ex.named_config
def maest_20s_from_passt_pretrain():
"time encodings for up to 20 seconds"
datamodule = {"clip_length": 20}
maest = {
"arch": "passt_s_swa_p16_128_ap476",
"pretrained": True,
"input_t": 20 * 16000 // 256,
"s_patchout_t": 60,
}
@ex.named_config
def maest_30s_from_passt_pretrain():
"time encodings for up to 30 seconds"
datamodule = {"clip_length": 30}
maest = {
"arch": "passt_s_swa_p16_128_ap476",
"pretrained": True,
"input_t": 30 * 16000 // 256,
"s_patchout_t": 90,
}
# Inference settings
@ex.named_config
def maest_5s_from_passt_inference():
"time encodings for up to 5 seconds"
datamodule = {"clip_length": 5}
maest = {
"arch": "discogs-maest-5s-pw-129e",
"pretrained": True,
"input_t": 5 * 16000 // 256,
}
predict = {"transformer_block": 7}
@ex.named_config
def maest_20s_from_passt_inference():
"time encodings for up to 20 seconds"
datamodule = {"clip_length": 20}
maest = {
"arch": "discogs-maest-20s-pw-129e",
"pretrained": True,
"input_t": 20 * 16000 // 256,
}
predict = {"transformer_block": 7}
@ex.named_config
def maest_30s_from_passt_inference():
"time encodings for up to 30 seconds"
datamodule = {"clip_length": 30}
maest = {
"arch": "discogs-maest-30s-pw-129e",
"pretrained": True,
"input_t": 30 * 16000 // 256,
}
predict = {"transformer_block": 7}
# Teacher/student setup (unreleased experiment due to uncertain results).
@ex.named_config
def maest_30s_from_passt_teacher_student_pretrain():
"time encodings for up to 30 seconds"
"using a teacher classifier"
datamodule = {
"batch_size_train": 4,
"clip_length": 30,
"teacher_student": {
"do": True,
"teacher_target_base_dir": "/home/palonso/reps/PaSST/logits/discogs/30sec/swa/11/",
},
}
maest = {
"arch": "passt_s_swa_p16_128_ap476",
"input_t": 30 * 16000 // 256,
"s_patchout_t": 90,
"distilled_type": "separated",
}
@ex.named_config
def maest_30s_from_passt_teacher_student_inference():
"time encodings for up to 30 seconds"
"using a teacher classifier"
datamodule = {
"batch_size_train": 4,
"clip_length": 30,
"teacher_student": {
"do": True,
"teacher_target_base_dir": "/home/palonso/reps/PaSST/logits/discogs/30sec/swa/11/",
},
}
maest = {
"arch": "discogs-maest-30s-pw-73e-ts",
"input_t": 30 * 16000 // 256,
"distilled_type": "separated",
}
predict = {"transformer_block": 7}
# Downstream evaluation pipeline
################################
# Embedding extraction
@ex.named_config
def target_mtt():
"Target the MTT (MagnaTagATune dataset)"
datamodule = {
"groundtruth_predict": "datasets/mtt/groundtruth-all.pk",
"base_dir": "datasets/mtt/data/mtt/melspec/",
}
predict = {
"out_dir": "outputs/embeddings/mtt/",
}
# Training probes
@ex.named_config
def target_mtt_tl():
"Target the MTT (MagnaTagATune dataset)"
data = {
"metadata_dir": "datasets/mtt/",
"base_dir": "outputs/embeddings/mtt/30sec/7/",
}