f90 / Wave-U-Net

Implementation of the Wave-U-Net for audio source separation
MIT License
824 stars 177 forks source link

Random seed #21

Closed jaesuny closed 5 years ago

jaesuny commented 5 years ago

Hello, I'm trying to find the validation set you used.

To split data into train/validation, you said you fixed the random seed. https://github.com/f90/Wave-U-Net/blob/55109a08f1f001ee9cf67829f27dbf128efacda0/Training.py#L208

I found you defined random seed in config, https://github.com/f90/Wave-U-Net/blob/48fb1a2118a2c392b931bdaf55f278d4c4347ca5/Config.py#L37

but I couldn't find where this value is used.

Where was the random seed fixed? Or, can you tell me the indices of validation split you used?

f90 commented 5 years ago

This appears confusing since the sacred package is doing a lot behind the scenes. See this page

https://sacred.readthedocs.io/en/latest/randomness.html

that explains that if you set a seed variable in the Sacred config, it will be used to initialise the RNG in python and also numpy. So Sacred takes care of setting up the RNG, and thus the 25 random songs are actually the same every time you recreate the dataset.

Does that clear everything up?

jaesuny commented 5 years ago

Thanks!

jaesuny commented 5 years ago

The seed value of Ingredient does not work. I found another seed value generated randomly just below Configuration (modified, added, typechanged, doc): by running following command.

$ python Training.py print_config with cfg.full_44KHz
Configuration (modified, added, typechanged, doc):
  seed = 350916074
  cfg:
    experiment_id = 259884
    seed = 1337
    model_config:                    # Base configuration
      augmentation = True
      batch_size = 16
      cache_size = 16
      context = True
      duration = 2
      epoch_it = 2000
      estimates_path = 'Source_Estimates'
      expected_sr = 44100
      filter_size = 15
      init_sup_sep_lr = 0.0001
      log_dir = 'logs'
      merge_filter_size = 5
      min_replacement_rate = 16
      model_base_dir = 'checkpoints'
      mono_downmix = False
      musdb_path = '/data/musdb18'
      network = 'unet'
      num_channels = 2
      num_frames = 16384
      num_initial_filters = 24
      num_layers = 12
      num_sources = 2
      num_workers = 6
      output_type = 'difference'
      raw_audio_loss = True
      task = 'voice'
      upsampling = 'learned'
      worse_epochs = 20

The seed value in the above is changed every time I run. And sacred package seems to use this seed.

I think you have to set seed using ex.config in Training.py.

f90 commented 5 years ago

Thanks for spotting this!! You are right, it worked before, but then I exported the configuration to Config.py and by introducing that "sub-configuration" it messed up setting the right seed! I committed a new version into the repository containing a fix, on my end the seed is now set correctly and produces the same random number in the training code each time.

Could you please pull the newest version and check if it's solved on your end? Thanks!

f90 commented 5 years ago

Fixed with the help of the generous @Jaesuny