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, drop_last=True) for _, (clean_speech, noisy_speech) in enumerate(train_dataloader): clean_speech = torch.Tensor(clean_speech).to(device) noisy_speech = torch.Tensor(noisy_speech).to(device) ref_batch = torch.cat([clean_speech, noisy_speech], 1)
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 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, args.rescale_method, 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, args.rescale_method, "None") 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')