|
| 1 | +name: score_based_generative_model |
| 2 | + |
| 3 | +model: |
| 4 | + type: score_based |
| 5 | + sample_rate: 16000 |
| 6 | + skip_nan_grad: false |
| 7 | + num_outputs: 1 |
| 8 | + normalize_input: true |
| 9 | + max_utts_evaluation_metrics: 50 # metric calculation needs full inference and is slow, so we limit to first few files |
| 10 | + |
| 11 | + train_ds: |
| 12 | + manifest_filepath: ??? |
| 13 | + input_key: noisy_filepath |
| 14 | + target_key: clean_filepath |
| 15 | + audio_duration: 2.04 # Number of STFT time frames = 1 + audio_duration // encoder.hop_length = 256 |
| 16 | + random_offset: true |
| 17 | + normalization_signal: input_signal |
| 18 | + batch_size: 8 # batch size may be increased based on the available memory |
| 19 | + shuffle: true |
| 20 | + num_workers: 8 |
| 21 | + pin_memory: true |
| 22 | + |
| 23 | + validation_ds: |
| 24 | + manifest_filepath: ??? |
| 25 | + input_key: noisy_filepath |
| 26 | + target_key: clean_filepath |
| 27 | + normalize_input: false # load data as is for validation, the model will normalize it for inference |
| 28 | + batch_size: 4 |
| 29 | + shuffle: false |
| 30 | + num_workers: 4 |
| 31 | + pin_memory: true |
| 32 | + |
| 33 | + encoder: |
| 34 | + _target_: nemo.collections.asr.modules.audio_preprocessing.AudioToSpectrogram |
| 35 | + fft_length: 510 # Number of subbands in the STFT = fft_length // 2 + 1 = 256 |
| 36 | + hop_length: 128 |
| 37 | + magnitude_power: 0.5 |
| 38 | + scale: 0.33 |
| 39 | + |
| 40 | + decoder: |
| 41 | + _target_: nemo.collections.asr.modules.audio_preprocessing.SpectrogramToAudio |
| 42 | + fft_length: ${model.encoder.fft_length} |
| 43 | + hop_length: ${model.encoder.hop_length} |
| 44 | + magnitude_power: ${model.encoder.magnitude_power} |
| 45 | + scale: ${model.encoder.scale} |
| 46 | + |
| 47 | + estimator: |
| 48 | + _target_: nemo.collections.asr.parts.submodules.diffusion.SpectrogramNoiseConditionalScoreNetworkPlusPlus |
| 49 | + in_channels: 2 # concatenation of single-channel perturbed and noisy |
| 50 | + out_channels: 1 # single-channel score estimate |
| 51 | + conditioned_on_time: true |
| 52 | + num_res_blocks: 3 # increased number of res blocks |
| 53 | + pad_time_to: 64 # pad to 64 frames for the time dimension |
| 54 | + pad_dimension_to: 0 # no padding in the frequency dimension |
| 55 | + |
| 56 | + sde: |
| 57 | + _target_: nemo.collections.asr.parts.submodules.diffusion.OrnsteinUhlenbeckVarianceExplodingSDE |
| 58 | + stiffness: 1.5 |
| 59 | + std_min: 0.05 |
| 60 | + std_max: 0.5 |
| 61 | + num_steps: 1000 |
| 62 | + |
| 63 | + sampler: |
| 64 | + _target_: nemo.collections.asr.parts.submodules.diffusion.PredictorCorrectorSampler |
| 65 | + predictor: reverse_diffusion |
| 66 | + corrector: annealed_langevin_dynamics |
| 67 | + num_steps: 50 |
| 68 | + num_corrector_steps: 1 |
| 69 | + snr: 0.5 |
| 70 | + |
| 71 | + loss: |
| 72 | + _target_: nemo.collections.asr.losses.MSELoss |
| 73 | + ndim: 4 # loss is calculated on the score in the encoded domain (batch, channel, dimension, time) |
| 74 | + |
| 75 | + metrics: |
| 76 | + val: |
| 77 | + sisdr: # output SI-SDR |
| 78 | + _target_: torchmetrics.audio.ScaleInvariantSignalDistortionRatio |
| 79 | + |
| 80 | + optim: |
| 81 | + name: adam |
| 82 | + lr: 1e-4 |
| 83 | + # optimizer arguments |
| 84 | + betas: [0.9, 0.999] |
| 85 | + weight_decay: 0.0 |
| 86 | + |
| 87 | +trainer: |
| 88 | + devices: -1 # number of GPUs, -1 would use all available GPUs |
| 89 | + num_nodes: 1 |
| 90 | + max_epochs: -1 |
| 91 | + max_steps: -1 # computed at runtime if not set |
| 92 | + val_check_interval: 1.0 # Set to 0.25 to check 4 times per epoch, or an int for number of iterations |
| 93 | + accelerator: auto |
| 94 | + strategy: ddp |
| 95 | + accumulate_grad_batches: 1 |
| 96 | + gradient_clip_val: null |
| 97 | + precision: 32 # Should be set to 16 for O1 and O2 to enable the AMP. |
| 98 | + log_every_n_steps: 25 # Interval of logging. |
| 99 | + enable_progress_bar: true |
| 100 | + num_sanity_val_steps: 0 # number of steps to perform validation steps for sanity check the validation process before starting the training, setting to 0 disables it |
| 101 | + check_val_every_n_epoch: 1 # number of evaluations on validation every n epochs |
| 102 | + sync_batchnorm: true |
| 103 | + enable_checkpointing: false # Provided by exp_manager |
| 104 | + logger: false # Provided by exp_manager |
| 105 | + |
| 106 | +exp_manager: |
| 107 | + exp_dir: null |
| 108 | + name: ${name} |
| 109 | + |
| 110 | + # use exponential moving average for model parameters |
| 111 | + ema: |
| 112 | + enable: true |
| 113 | + decay: 0.999 # decay rate |
| 114 | + cpu_offload: false # offload EMA parameters to CPU to save GPU memory |
| 115 | + every_n_steps: 1 # how often to update EMA weights |
| 116 | + validate_original_weights: false # use original weights for validation calculation? |
| 117 | + |
| 118 | + # logging |
| 119 | + create_tensorboard_logger: true |
| 120 | + |
| 121 | + # checkpointing |
| 122 | + create_checkpoint_callback: true |
| 123 | + checkpoint_callback_params: |
| 124 | + # in case of multiple validation sets, first one is used |
| 125 | + monitor: val_sisdr |
| 126 | + mode: max |
| 127 | + save_top_k: 5 |
| 128 | + always_save_nemo: true # saves the checkpoints as nemo files instead of PTL checkpoints |
| 129 | + |
| 130 | + # early stopping |
| 131 | + create_early_stopping_callback: true |
| 132 | + early_stopping_callback_params: |
| 133 | + monitor: val_sisdr |
| 134 | + mode: max |
| 135 | + min_delta: 0.0 |
| 136 | + patience: 20 # patience in terms of check_val_every_n_epoch |
| 137 | + verbose: true |
| 138 | + strict: false # Should be False to avoid a runtime error where EarlyStopping says monitor is unavailable, which sometimes happens with resumed training. |
| 139 | + |
| 140 | + resume_from_checkpoint: null # The path to a checkpoint file to continue the training, restores the whole state including the epoch, step, LR schedulers, apex, etc. |
| 141 | + # you need to set these two to true to continue the training |
| 142 | + resume_if_exists: false |
| 143 | + resume_ignore_no_checkpoint: false |
| 144 | + |
| 145 | + # You may use this section to create a W&B logger |
| 146 | + create_wandb_logger: false |
| 147 | + wandb_logger_kwargs: |
| 148 | + name: null |
| 149 | + project: null |
0 commit comments