提交 0908e4d3 编写于 作者: C Corentin Jemine

Removed some unused code

上级 5abcce45
......@@ -82,29 +82,3 @@ def run_synthesis(in_dir, out_dir, model_dir, hparams):
print("Synthesized mel spectrograms at {}".format(synth_dir))
return meta_out_fpath
def tacotron_synthesize(args, hparams, checkpoint, sentences=None):
output_dir = args.output_dir
try:
checkpoint_path = tf.train.get_checkpoint_state(checkpoint).model_checkpoint_path
log("loaded model at {}".format(checkpoint_path))
except:
raise RuntimeError("Failed to load checkpoint at {}".format(checkpoint))
if hparams.tacotron_synthesis_batch_size < hparams.tacotron_num_gpus:
raise ValueError("Defined synthesis batch size {} is smaller than minimum required {} "
"(num_gpus)! Please verify your synthesis batch size choice.".format(
hparams.tacotron_synthesis_batch_size, hparams.tacotron_num_gpus))
if hparams.tacotron_synthesis_batch_size % hparams.tacotron_num_gpus != 0:
raise ValueError("Defined synthesis batch size {} is not a multiple of {} (num_gpus)! "
"Please verify your synthesis batch size choice!".format(
hparams.tacotron_synthesis_batch_size, hparams.tacotron_num_gpus))
if args.mode == "eval":
return run_eval(args, checkpoint_path, output_dir, hparams, sentences)
elif args.mode == "synthesis":
return run_synthesis(args, checkpoint_path, output_dir, hparams)
else:
run_live(args, checkpoint_path, hparams)
......@@ -330,46 +330,13 @@ def train(log_dir, args, hparams):
saver.save(sess, checkpoint_fpath, global_step=global_step)
log("\nSaving alignment, Mel-Spectrograms and griffin-lim inverted waveform..")
if hparams.predict_linear:
input_seq, mel_prediction, linear_prediction, alignment, target, target_length, linear_target = sess.run(
[
model.tower_inputs[0][0],
model.tower_mel_outputs[0][0],
model.tower_linear_outputs[0][0],
model.tower_alignments[0][0],
model.tower_mel_targets[0][0],
model.tower_targets_lengths[0][0],
model.tower_linear_targets[0][0],
])
# save predicted linear spectrogram to disk (debug)
linear_filename = "linear-prediction-step-{}.npy".format(step)
np.save(os.path.join(linear_dir, linear_filename), linear_prediction.T,
allow_pickle=False)
# save griffin lim inverted wav for debug (linear -> wav)
wav = audio.inv_linear_spectrogram(linear_prediction.T, hparams)
audio.save_wav(wav, os.path.join(wav_dir, "step-{}-wave-from-linear.wav"
"".format(step)),
sr=hparams.sample_rate)
# Save real and predicted linear-spectrogram plot to disk (control purposes)
plot.plot_spectrogram(linear_prediction, os.path.join(plot_dir,
"step-{}-linear-spectrogram.png".format(
step)),
title="{}, {}, step={}, loss={:.5f}".format(
"Tacotron", time_string(), step, loss),
target_spectrogram=linear_target,
max_len=target_length, auto_aspect=True)
else:
input_seq, mel_prediction, alignment, target, target_length = sess.run([
model.tower_inputs[0][0],
model.tower_mel_outputs[0][0],
model.tower_alignments[0][0],
model.tower_mel_targets[0][0],
model.tower_targets_lengths[0][0],
])
input_seq, mel_prediction, alignment, target, target_length = sess.run([
model.tower_inputs[0][0],
model.tower_mel_outputs[0][0],
model.tower_alignments[0][0],
model.tower_mel_targets[0][0],
model.tower_targets_lengths[0][0],
])
# save predicted mel spectrogram to disk (debug)
mel_filename = "mel-prediction-step-{}.npy".format(step)
......
......@@ -13,7 +13,7 @@ def progbar(i, n, size=16):
def stream(message) :
sys.stdout.write(f"\r{message}")
sys.stdout.write("\r{%s}" % message)
def simple_table(item_tuples) :
......
......@@ -4,6 +4,7 @@ import torch.nn.functional as F
from utils.display import *
from utils.dsp import *
class WaveRNN(nn.Module) :
def __init__(self, hidden_size=896, quantisation=256) :
super(WaveRNN, self).__init__()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册