padding_idx=hparams.padding_idx, use_memory_mask=hparams.use_memory_mask, ) model = model.cuda() #model = DataParallelFix(model) optimizer = optim.Adam(model.parameters(), lr=hparams.initial_learning_rate, betas=( hparams.adam_beta1, hparams.adam_beta2), weight_decay=hparams.weight_decay) # Load checkpoint if checkpoint_path: print("Load checkpoint from: {}".format(checkpoint_path)) checkpoint = torch.load(checkpoint_path) model.load_state_dict(checkpoint["state_dict"]) optimizer.load_state_dict(checkpoint["optimizer"]) try: global_step = int(checkpoint["global_step"]) global_epoch = int(checkpoint["global_epoch"]) except: # TODO pass # Setup tensorboard logger tensorboard_logger.configure(log_path) #print(hparams_debug_string()) # Train! try:
) vocoder_model = WaveLSTM( n_vocab=257, embedding_dim=256, mel_dim=hparams.num_mels, linear_dim=hparams.num_freq, r=hparams.outputs_per_step, padding_idx=hparams.padding_idx, use_memory_mask=hparams.use_memory_mask, ) #checkpoint = torch.load(checkpoint_path) #checkpoints_dir = os.path.dirname(checkpoint_path) acousticmodel.load_state_dict(checkpoint_acousticmodel["state_dict"]) acousticmodel.decoder.max_decoder_steps = max_decoder_steps os.makedirs(dst_dir, exist_ok=True) vocoder_checkpoint_path = 'exp/exp_vocoding_bsz4seqlen8_cloneofwavernn/checkpoints/checkpoint_step1400000.pth' vocoder_model.load_state_dict(checkpoint_vocoder["state_dict"]) with open(text_list_file_path, "rb") as f: lines = f.readlines() for idx, line in enumerate(lines): fname = line.decode("utf-8").split()[0].zfill(8) cmd = 'cp vox/wav/' + fname + '.wav ' + dst_dir + '/' + fname + '_original.wav' print(cmd) os.system(cmd) text = ' '.join(k for k in line.decode("utf-8").split()[1:])