# @package _group_
common:
  fp16: true
  log_format: json
  log_interval: 100
  seed: 1337
  # tensorboard_logdir: tblog_proj_name
  # wandb_project: wandb_proj_name

checkpoint:
  save_interval_updates: 5000
  keep_interval_updates: -1
  no_epoch_checkpoints: true


distributed_training:
  ddp_backend: no_c10d
  distributed_backend: 'nccl'
  distributed_world_size: 64
  nprocs_per_node: 8
  find_unused_parameters: true

task:
  _name: mert_pretraining
  data: ???
  label_dir: ???
  labels: ???
  label_rate: ${model.label_rate}
  sharding_data: 6
  load_random_data_shard: false
  sample_rate: 24000
  # crop to 5s
  # max_sample_size: 120000
  # crop to 5.12s, refers to 384 token per audio, which can be devided by 8.
  max_sample_size: 122880
  min_sample_size: 72000

  pad_audio: false
  random_crop: true
  # normalize: true # must be consistent with extractor_mode: layer_norm
  normalize: false # must be consistent with extractor_mode: default (groupnorm)


dataset:
  num_workers: 6
  max_tokens: 900000
  skip_invalid_size_inputs_valid_test: true
  validate_interval: 1
  validate_interval_updates: 10000

criterion:
  _name: hubert
  pred_masked_weight: 1.0
  pred_nomask_weight: 0.0
  loss_weights: [10, 1]

optimization:
  max_update: 400000
  lr: [0.0015]
  clip_norm: 1.0
  update_freq: [8]

optimizer:
  _name: adam
  adam_betas: (0.9,0.98)
  adam_eps: 1e-06
  weight_decay: 0.01

lr_scheduler:
  _name: polynomial_decay
  warmup_updates: 32000

model:
  _name: mert
  label_rate: ???
  skip_masked: false
  skip_nomask: true
  mask_prob: 0.8
  mask_length: 5

  logit_temp: 0.1


  # ----- mixture ------
  mixture_prob: 0.5
  inbatch_noise_augment_len_range: "[12000, 36000]"
  inbatch_noise_augment_number_range: "[1, 3]"
  inbatch_noise_augment_volume: 1.0
  # ------------------------

  # ---- cqt reconstruction, need to add loss weight ---
  audio_cqt_loss_m: true
  audio_cqt_bins: 336

  final_dim: 128
  encoder_layers: 24
  encoder_embed_dim: 1024
  encoder_ffn_embed_dim: 4096
  encoder_attention_heads: 16
  # default refers to group norm
  extractor_mode: default
  # extractor_mode: layer_norm
  conv_feature_layers: '[(512,10,5)] + [(512,3,2)] * 4 + [(512,2,2)] * 2'
  encoder_layerdrop: 0.0
  dropout_input: 0.0
  dropout_features: 0.0
  dropout: 0.0
  attention_dropout: 0.0

  layer_norm_first: true
  feature_grad_mult: 1.0

  untie_final_proj: true
  activation_dropout: 0.0

  deepnorm: false
  attention_relax: 32.0



hydra:
  job:
    config:
      override_dirname:
        kv_sep: '-'
        item_sep: '__'
        exclude_keys:
          - run
          - task.data
          - task.label_dir
  run:
    dir: ???
  sweep:
    dir: ???
    subdir: ${hydra.job.config_name}__${hydra.job.override_dirname}
