more prunning and dataloader file encoding for win10

This commit is contained in:
Eren G 2018-07-12 19:03:39 +02:00
parent 5bf3ff345f
commit 1160ea5a19
2 changed files with 9 additions and 15 deletions

View File

@ -18,7 +18,7 @@ class LJSpeechDataset(Dataset):
frame_length_ms, preemphasis, ref_level_db, num_freq, power,
min_seq_len=0):
with open(csv_file, "r") as f:
with open(csv_file, "r", encoding="utf8") as f:
self.frames = [line.split('|') for line in f]
self.root_dir = root_dir
self.outputs_per_step = outputs_per_step

View File

@ -48,12 +48,6 @@ OUT_PATH = create_experiment_folder(OUT_PATH, c.model_name, args.debug)
CHECKPOINT_PATH = os.path.join(OUT_PATH, 'checkpoints')
shutil.copyfile(args.config_path, os.path.join(OUT_PATH, 'config.json'))
parser.add_argument('--finetine_path', type=str)
# save config to tmp place to be loaded by subsequent modules.
file_name = str(os.getpid())
tmp_path = os.path.join("/tmp/", file_name+'_tts')
pickle.dump(c, open(tmp_path, "wb"))
# setup tensorboard
LOG_DIR = OUT_PATH
tb = SummaryWriter(LOG_DIR)
@ -150,9 +144,9 @@ def train(model, criterion, criterion_st, data_loader, optimizer, optimizer_st,
# ('grad_norm_st', grad_norm_st.item())])
if current_step % c.print_step == 0:
print(" | | > Step:{} GlobalStep:{} TotalLoss:{:.5f} LinearLoss:{:.5f} MelLoss:\
{:.5f} StopLoss:{:.5f} GradNorm:{:.5f} \
GradNormST:{:.5f} StepTime:{:.2f}".format(num_iter, current_step,
print(" | | > Step:{} GlobalStep:{} TotalLoss:{:.5f} LinearLoss:{:.5f}"\
"MelLoss:{:.5f} StopLoss:{:.5f} GradNorm:{:.5f}"\
"GradNormST:{:.5f} StepTime:{:.2f}".format(num_iter, current_step,
loss.item(),
linear_loss.item(),
mel_loss.item(),
@ -215,9 +209,9 @@ def train(model, criterion, criterion_st, data_loader, optimizer, optimizer_st,
avg_total_loss = avg_mel_loss + avg_linear_loss + avg_stop_loss
# print epoch stats
print(" | | > EPOCH END -- GlobalStep:{} AvgTotalLoss:{:.5f} \
AvgLinearLoss:{:.5f} AvgMelLoss:{:.5f} \
AvgStopLoss:{:.5f} EpochTime:{:.2f}".format(current_step,
print(" | | > EPOCH END -- GlobalStep:{} AvgTotalLoss:{:.5f}"\
"AvgLinearLoss:{:.5f} AvgMelLoss:{:.5f}"\
"AvgStopLoss:{:.5f} EpochTime:{:.2f}".format(current_step,
avg_total_loss,
avg_linear_loss,
avg_mel_loss,
@ -290,8 +284,8 @@ def evaluate(model, criterion, criterion_st, data_loader, current_step):
# ('mel_loss', mel_loss.item()),
# ('stop_loss', stop_loss.item())])
if current_step % c.print_step == 0:
print(" | | > TotalLoss: {:.5f} LinearLoss: {:.5f} MelLoss: \
{:.5f} StopLoss: {:.5f} ".format(loss.item(),
print(" | | > TotalLoss: {:.5f} LinearLoss: {:.5f} MelLoss:{:.5f}"\
"StopLoss: {:.5f} ".format(loss.item(),
linear_loss.item(),
mel_loss.item(),
stop_loss.item()))