File size: 9,421 Bytes
9f748f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
train_config:
  expdir: YOUR_DATA_ROOT_DIR/audio-flamingo-data/checkpoint
  run_name: foundation_sft_8_shot
  delete_previous_checkpoint: true 
  batch_size: 4
  gradient_accumulation_steps: 4  # global batchsize = 128
  seed: 42
  learning_rate: 0.00002
  lr_scheduler: constant
  loss_multiplier: 1.0
  warmup_steps: 1875
  weight_decay: 0.1
  precision: fp32
  gradient_checkpointing: False 
  num_epochs: 100  # num_epochs * dataset_blending_global_weight = 1
  offline: false
  freeze_lm_embeddings: false
  logging_steps: 10
  dist_backend: nccl
  dist_url: env://
  no_set_device_rank: false 
  fsdp: true 
  fsdp_use_orig_params: false  # Passed into the FSDP constructor. Enables param_groups and gradient masking for weight_decay. Does not work with OPT.
  fsdp_sharding_strategy: full  # full, hybrid
  horovod: false

# SFT hparams
sft_config:
  pretrained_path: YOUR_DATA_ROOT_DIR/audio-flamingo-data/checkpoint/foundation_pretrain/
  pretrained_ckpt: checkpoint_99.pt
  unfreeze_full_lm: true

data_config:
  dataset_blending_global_weight: 0.01

  dataset_blending_config:

    # Audio QA

    Clotho-AQA-AQA/train:
      weight: 3.5
      prefix_prob: 1.0
      augmentations:
        AQA_binary_instruction: 1.0
    Clotho-AQA-AQA/interleaved_knn-train:
      weight: 0.5
      prefix_prob: 1.0
      augmentations:
        AQA_binary_instruction: 1.0

    OpenAQA-AQA/train:
      weight: 0.1
      prefix_prob: 1.0
      augmentations:
        do_nothing: 1.0

    # Audio Captioning 

    Clotho-v2-AudioCaptioning/train: 
      weight: 2.0
      prefix_prob: 1.0
      augmentations:
        AC_short: 1.0
    Clotho-v2-AudioCaptioning/interleaved_knn-train: 
      weight: 0.5
      prefix_prob: 1.0
      augmentations:
        AC_short: 1.0

    Epidemic_sound-AudioCaptioning/train: 
      weight: 0.8
      prefix_prob: 1.0
      augmentations:
        AC_short: 1.0
    Epidemic_sound-AudioCaptioning/interleaved_knn-train: 
      weight: 0.2
      prefix_prob: 1.0
      augmentations:
        AC_short: 1.0

    MACS-AudioCaptioning/train: 
      weight: 0.8
      prefix_prob: 1.0
      augmentations:
        AC_short: 1.0
    MACS-AudioCaptioning/interleaved_knn-train: 
      weight: 0.2
      prefix_prob: 1.0
      augmentations:
        AC_short: 1.0

    # Audio Classification

    FSD50k-EventClassification/train: 
      weight: 0.9
      prefix_prob: 1.0
      augmentations:
        default: 1.0
    FSD50k-EventClassification/interleaved_knn-train: 
      weight: 0.3
      prefix_prob: 1.0
      augmentations:
        default: 1.0

    CochlScene-SceneClassification/train: 
      weight: 1.2
      prefix_prob: 1.0
      augmentations:
        provide_all_labels: 0.9
        default: 0.1
    CochlScene-SceneClassification/interleaved_knn-train: 
      weight: 0.3
      prefix_prob: 1.0
      augmentations:
        provide_all_labels: 0.9
        default: 0.1

    NonSpeech7k-EventClassification/train: 
      weight: 2.4
      prefix_prob: 1.0
      augmentations:
        provide_all_labels: 0.9
        default: 0.1
    NonSpeech7k-EventClassification/interleaved_knn-train: 
      weight: 0.6
      prefix_prob: 1.0
      augmentations:
        provide_all_labels: 0.9
        default: 0.1

    chime-home-EventClassification/train: 
      weight: 1.5
      prefix_prob: 1.0
      augmentations:
        default: 0.5
        num_words: 0.5
    chime-home-EventClassification/interleaved_knn-train: 
      weight: 0.5
      prefix_prob: 1.0
      augmentations:
        default: 0.5
        num_words: 0.5

    SONYC-UST-EventClassification/train: 
      weight: 0.8
      prefix_prob: 1.0
      augmentations:
        default: 0.5
        num_words: 0.5
    SONYC-UST-EventClassification/interleaved_knn-train: 
      weight: 0.2
      prefix_prob: 1.0
      augmentations:
        default: 0.5
        num_words: 0.5

    # Speech Emotion Classification

    emov-db-EmotionClassification/train:
      weight: 1.6
      prefix_prob: 1.0
      augmentations:
        provide_all_labels: 0.9
        default: 0.1
    emov-db-EmotionClassification/interleaved_knn-train:
      weight: 0.4
      prefix_prob: 1.0
      augmentations:
        provide_all_labels: 0.9
        default: 0.1

    jl-corpus-EmotionClassification/train:
      weight: 6.0
      prefix_prob: 1.0
      augmentations:
        provide_all_labels: 0.9
        default: 0.1
    jl-corpus-EmotionClassification/interleaved_knn-train:
      weight: 1.5
      prefix_prob: 1.0
      augmentations:
        provide_all_labels: 0.9
        default: 0.1

    tess-EmotionClassification/train:
      weight: 2.0
      prefix_prob: 1.0
      augmentations:
        provide_all_labels: 0.9
        default: 0.1
    tess-EmotionClassification/interleaved_knn-train:
      weight: 0.5
      prefix_prob: 1.0
      augmentations:
        provide_all_labels: 0.9
        default: 0.1

    OMGEmotion-EmotionClassification/train:
      weight: 3.0
      prefix_prob: 1.0
      augmentations:
        provide_all_labels: 0.9
        default: 0.1

    # Music QA
    
    Music-AVQA-AQA_All/train:
      weight: 5.0
      prefix_prob: 1.0
      augmentations:
        AQA_binary_instruction: 1.0
    Music-AVQA-AQA_All/interleaved_knn-train:
      weight: 1.0
      prefix_prob: 1.0
      augmentations:
        AQA_binary_instruction: 1.0

    MU-LLAMA-AQA/train:
      weight: 0.35
      prefix_prob: 1.0
      augmentations:
        do_nothing: 1.0
    MU-LLAMA-AQA/interleaved_knn-train:
      weight: 0.05
      prefix_prob: 1.0
      augmentations:
        do_nothing: 1.0

    # Music Captioning

    LP-MusicCaps-MSD-AudioCaptioning/train:
      weight: 0.025
      prefix_prob: 1.0
      augmentations:
        AC_paragraph: 1.0
    LP-MusicCaps-MSD-AudioCaptioning/interleaved_knn-train:
      weight: 0.007
      prefix_prob: 1.0
      augmentations:
        AC_paragraph: 1.0
    
    LP-MusicCaps-MC-AudioCaptioning/train:
      weight: 2.0
      prefix_prob: 1.0
      augmentations:
        AC_paragraph: 1.0

    LP-MusicCaps-MTT-AudioCaptioning/train:
      weight: 0.8
      prefix_prob: 1.0
      augmentations:
        AC_long: 1.0
    LP-MusicCaps-MTT-AudioCaptioning/interleaved_knn-train:
      weight: 0.2
      prefix_prob: 1.0
      augmentations:
        AC_long: 1.0

    MusicCaps-AudioCaptioning/train:
      weight: 6.0
      prefix_prob: 1.0
      augmentations:
        AC_paragraph: 1.0

    # Music Understanding 

    NSynth-MIR/train:
      weight: 1.0
      prefix_prob: 1.0
      augmentations:
        do_nothing: 1.0
    NSynth-MIR/interleaved_knn-train:
      weight: 1.0
      prefix_prob: 1.0
      augmentations:
        do_nothing: 1.0

    mtg-jamendo-MusicTagging/train:
      weight: 0.1
      prefix_prob: 1.0
      augmentations:
        default: 1.0
    
    FMA-GenreClassification/train:
      weight: 0.4
      prefix_prob: 1.0
      augmentations:
        do_nothing: 1.0
    FMA-GenreClassification/interleaved_knn-train:
      weight: 0.3
      prefix_prob: 1.0
      augmentations:
        do_nothing: 1.0

    musdbhq-InstrClassification/train:
      weight: 1.0
      prefix_prob: 1.0
      augmentations:
        provide_all_labels: 0.9
        default: 0.1
    
  dataset_file_root: YOUR_DATA_ROOT_DIR/audio-flamingo-data/dataset_files
  data_root: YOUR_DATA_ROOT_DIR/datasets
  dataset_blending_output: dataset_blending.json
  max_tokens: 512
  num_workers: 4

  valid_dataset_config: 
    Clotho-AQA-AQA/val: true
    Clotho-v2-AudioCaptioning/val: true
    Clotho-v2-AudioCaptioning/interleaved_knn-val: true
    CochlScene-SceneClassification/val: true
    CochlScene-SceneClassification/interleaved_knn-val: true
    SONYC-UST-EventClassification/val: true
    SONYC-UST-EventClassification/interleaved_knn-val: true
    emov-db-EmotionClassification/val: true
    emov-db-EmotionClassification/interleaved_knn-val: true
    jl-corpus-EmotionClassification/val: true
    jl-corpus-EmotionClassification/interleaved_knn-val: true
    tess-EmotionClassification/val: true
    tess-EmotionClassification/interleaved_knn-val: true
    OMGEmotion-EmotionClassification/val: true
    Music-AVQA-AQA_All/val: true
    Music-AVQA-AQA_All/interleaved_knn-val: true
    LP-MusicCaps-MTT-AudioCaptioning/val: true
    LP-MusicCaps-MTT-AudioCaptioning/interleaved_knn-val: true
    NSynth-MIR/val: true
    mtg-jamendo-MusicTagging/val: true

clap_config:
  # method: laion-clap
  # audio_embed_dim: 512
  # model_name: 630k-fusion-best
  # checkpoint: YOUR_DATA_ROOT_DIR/audio-flamingo-data/laion-clap-pretrained/laion_clap/630k-fusion-best.pt
  
  method: microsoft-clap
  audio_embed_dim: 1024
  config_root: YOUR_REPO_ROOT_DIR/foundation/my_ms_clap/src/configs
  model_name: 'clapcap'
  checkpoint: YOUR_DATA_ROOT_DIR/audio-flamingo-data/clap/clapcap_weights_2023.pth

  window_length: 7.0  # seconds
  window_overlap: 5.25  # seconds
  max_num_window: 16  # total = 33.25 seconds
  max_num_fewshot: 8  # number of fewshot samples

model_config:
  cache_dir: YOUR_DATA_ROOT_DIR/audio-flamingo-data/LLM_pretrained/.cache

  lang_encoder_path: facebook/opt-iml-max-1.3b
  tokenizer_path: facebook/opt-iml-max-1.3b
  cross_attn_every_n_layers: 1
  audio_transformer_kwargs: {
    n_head: 8,
    n_layers: 3,
    d_inner: 2048,
    max_num_media: 128,  # must >= max_num_window * num_fewshot_samples
    max_window_per_audio: 16,  # must = max_num_window
  }