def load_dataset(args): train_dataset = LJspeechDataset(args.data_path, True, 0.1) test_dataset = LJspeechDataset(args.data_path, False, 0.1) train_loader = DataLoader(train_dataset, batch_size=args.batch_size, shuffle=True, collate_fn=collate_fn, num_workers=args.num_workers, pin_memory=True) test_loader = DataLoader(test_dataset, batch_size=args.batch_size, collate_fn=collate_fn, num_workers=args.num_workers, pin_memory=True) synth_loader = DataLoader(test_dataset, batch_size=1, collate_fn=collate_fn_synthesize, num_workers=args.num_workers, pin_memory=True) return train_loader, test_loader, synth_loader
def load_dataset(args): test_dataset = LJspeechDataset(args.data_path, False, 0.1) synth_loader = DataLoader(test_dataset, batch_size=1, collate_fn=collate_fn_synthesize, num_workers=args.num_workers, pin_memory=True) return synth_loader
if not os.path.isdir(args.save): os.makedirs(args.save) if not os.path.isdir(args.loss): os.makedirs(args.loss) if not os.path.isdir(args.sample_path): os.makedirs(args.sample_path) if not os.path.isdir(os.path.join(args.sample_path, args.model_name)): os.makedirs(os.path.join(args.sample_path, args.model_name)) if not os.path.isdir(os.path.join(args.save, args.model_name)): os.makedirs(os.path.join(args.save, args.model_name)) use_cuda = torch.cuda.is_available() device = torch.device("cuda" if use_cuda else "cpu") # LOAD DATASETS train_dataset = LJspeechDataset(args.data_path, True, 0.1) test_dataset = LJspeechDataset(args.data_path, False, 0.1) train_loader = DataLoader(train_dataset, batch_size=args.batch_size, shuffle=True, collate_fn=collate_fn, num_workers=args.num_workers, pin_memory=True) test_loader = DataLoader(test_dataset, batch_size=args.batch_size, collate_fn=collate_fn, num_workers=args.num_workers, pin_memory=True) synth_loader = DataLoader(test_dataset, batch_size=1, collate_fn=collate_fn_synthesize,
default=0, help='Number of workers') parser.add_argument('--log', type=str, default='./log', help='Log folder.') args = parser.parse_args() if not os.path.isdir(args.sample_path): os.makedirs(args.sample_path) if not os.path.isdir(os.path.join(args.sample_path, args.model_name)): os.makedirs(os.path.join(args.sample_path, args.model_name)) use_cuda = torch.cuda.is_available() device = torch.device("cuda" if use_cuda else "cpu") # LOAD DATASETS test_dataset = LJspeechDataset(args.data_path, False, 0.1) synth_loader = DataLoader(test_dataset, batch_size=1, collate_fn=collate_fn_synthesize, num_workers=args.num_workers, pin_memory=True) def build_model(): causality = True if args.causal == 'yes' else False model = Flowavenet(in_channel=1, cin_channel=args.cin_channels, n_block=args.n_block, n_flow=args.n_flow, n_layer=args.n_layer, affine=True,