opts['log_label_min'] = 0 real_data_min = 13.76 real_data_max = -19.35 dis_opts = {} if adversarial_loss == "wgangp_loss": dis_opts["alpha"] = 10. elif adversarial_loss == "hinge_loss": dis_opts["margin"] = 1. if args.feature_domain.lower() == "mel": from kaldi_fbank_dataset import FbankDataloader, FrameDataset else: from kaldi_fft_dataset import FbankDataloader, FrameDataset train_dataset = FrameDataset([-6, -3, 0, 3, 6, 9], NOISE_LIST, TR05_SIMU_LIST, args.clean_type, True, None, args.data_augment) train_dataloader = FbankDataloader(train_dataset, opts, BATCH_SIZE, True, num_workers=4, drop_last=True) valid_dataset = FrameDataset([-6, -3, 0, 3, 6, 9], NOISE_LIST, DT05_SIMU_LIST, args.clean_type, False, None, args.data_augment) valid_dataloader = FbankDataloader(valid_dataset, opts, BATCH_SIZE, True, num_workers=4, drop_last=True) logger.info("Done.") logger.info("Start to construct model...") device = torch.device('cuda') Generator, Discriminator = get_model(gen_model, dis_model) if adversarial_loss: disc_d_loss, disc_g_loss = get_disc_loss(adversarial_loss) reconstruction_loss = get_recon_loss(reconstruction_loss) calc_target = get_target(args.target_type)
if "gp" in args.adversarial_loss: dis_opts["gp_alpha"] = 0. if args.adversarial_loss == "hinge": dis_opts["hinge_margin"] = 1. dis_opts["l1_alpha"] = args.l1_alpha dis_opts["l2_alpha"] = args.l2_alpha if args.feature_domain.lower() == "mel": from kaldi_fbank_dataset import FbankDataloader, FrameDataset elif args.feature_domain.lower() == "waveform": from segan_dataset import FbankDataloader, FrameDataset else: from kaldi_fft_dataset import FbankDataloader, FrameDataset train_dataset = FrameDataset([-6, -3, 0, 3, 6, 9], NOISE_LIST, TR05_SIMU_LIST, args.clean_type, True, "value_norm", args.data_augment) train_dataloader = FbankDataloader(train_dataset, opts, BATCH_SIZE, True, num_workers=4, drop_last=True) valid_dataset = FrameDataset([-6, -3, 0, 3, 6, 9], NOISE_LIST, DT05_SIMU_LIST, args.clean_type, False, "value_norm", "None") valid_dataloader = FbankDataloader(valid_dataset, opts, BATCH_SIZE, True, num_workers=4,
opts['clip_low'] = 0. opts['clip_high'] = 1. opts['log_power_offset'] = 10. dis_opts = {} if adversarial_loss == "wgangp_loss": dis_opts["alpha"] = 10. elif adversarial_loss == "hinge_loss": dis_opts["margin"] = 1. if args.feature_domain.lower() == "mel": from kaldi_fbank_dataset import FbankDataloader, FrameDataset else: from kaldi_fft_dataset import FbankDataloader, FrameDataset train_dataset = FrameDataset([0, 3, 6], NOISE_LIST, TR05_SIMU_LIST, args.clean_type, True, None) train_dataloader = FbankDataloader(train_dataset, opts, BATCH_SIZE, True, num_workers=4, drop_last=True) valid_dataset = FrameDataset([0, 3, 6], NOISE_LIST, DT05_SIMU_LIST, args.clean_type, False, None) valid_dataloader = FbankDataloader(valid_dataset, opts, BATCH_SIZE, True, num_workers=4, drop_last=True) logger.info("Done.")