From 3717ac134267e59928ec3d090a4783513f1db1df Mon Sep 17 00:00:00 2001 From: chenfeiyu Date: Tue, 11 Aug 2020 09:12:50 +0000 Subject: [PATCH] add max_iteration into configuration, fix np.pad for lower versions of numpy --- examples/deepvoice3/README.md | 2 +- examples/deepvoice3/configs/ljspeech.yaml | 1 + examples/deepvoice3/data.py | 6 ++---- examples/deepvoice3/train.py | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/deepvoice3/README.md b/examples/deepvoice3/README.md index 4f939e1..3e4b0b3 100644 --- a/examples/deepvoice3/README.md +++ b/examples/deepvoice3/README.md @@ -87,7 +87,7 @@ runs/Jul07_09-39-34_instance-mqcyj27y-4/ ... ``` -Since e use waveflow to synthesize audio while training, so download the trained waveflow model and extract it in current directory before training. +Since we use waveflow to synthesize audio while training, so download the trained waveflow model and extract it in current directory before training. ```bash wget https://paddlespeech.bj.bcebos.com/Parakeet/waveflow_res128_ljspeech_ckpt_1.0.zip diff --git a/examples/deepvoice3/configs/ljspeech.yaml b/examples/deepvoice3/configs/ljspeech.yaml index cbcaa9c..1e8ec7b 100644 --- a/examples/deepvoice3/configs/ljspeech.yaml +++ b/examples/deepvoice3/configs/ljspeech.yaml @@ -39,6 +39,7 @@ clip_value: 5.0 clip_norm: 100.0 # training: +max_iteration: 1000000 batch_size: 16 report_interval: 10000 save_interval: 10000 diff --git a/examples/deepvoice3/data.py b/examples/deepvoice3/data.py index 3e30c95..984f963 100644 --- a/examples/deepvoice3/data.py +++ b/examples/deepvoice3/data.py @@ -62,10 +62,8 @@ class DataCollector(object): for example in examples: text, spec, mel, _ = example text_seqs.append(en.text_to_sequence(text, self.p_pronunciation)) - # if max_frames - mel.shape[0] < 0: - # import pdb; pdb.set_trace() - specs.append(np.pad(spec, [(0, max_frames - spec.shape[0]), (0, 0)])) - mels.append(np.pad(mel, [(0, max_frames - mel.shape[0]), (0, 0)])) + specs.append(np.pad(spec, [(0, max_frames - spec.shape[0]), (0, 0)], mode="constant")) + mels.append(np.pad(mel, [(0, max_frames - mel.shape[0]), (0, 0)], mode="constant")) specs = np.stack(specs) mels = np.stack(mels) diff --git a/examples/deepvoice3/train.py b/examples/deepvoice3/train.py index 07f5c94..8e629c3 100644 --- a/examples/deepvoice3/train.py +++ b/examples/deepvoice3/train.py @@ -81,7 +81,7 @@ def train(args, config): optim = create_optimizer(model, config) global global_step - max_iteration = 1000000 + max_iteration = config["max_iteration"] iterator = iter(tqdm.tqdm(train_loader)) while global_step <= max_iteration: