From 2e9ffcb6d00798e81fd36618282fb5d519bb6312 Mon Sep 17 00:00:00 2001 From: iclementine Date: Fri, 20 Aug 2021 20:46:20 +0800 Subject: [PATCH] fix argparse argument names, update shell scripts --- examples/parallelwave_gan/baker/train.py | 4 ++-- examples/speedyspeech/baker/README.md | 4 ++-- examples/speedyspeech/baker/synthesize.py | 4 ++-- examples/speedyspeech/baker/synthesize.sh | 2 +- examples/speedyspeech/baker/synthesize_e2e.sh | 2 +- examples/speedyspeech/baker/train.py | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/parallelwave_gan/baker/train.py b/examples/parallelwave_gan/baker/train.py index 7082494..ab76bd3 100644 --- a/examples/parallelwave_gan/baker/train.py +++ b/examples/parallelwave_gan/baker/train.py @@ -44,11 +44,11 @@ from pwg_updater import PWGUpdater, PWGEvaluator def train_sp(args, config): # decides device type and whether to run in parallel # setup running environment correctly - if not paddle.is_compiled_with_cuda: + world_size = paddle.distributed.get_world_size() + if not paddle.is_compiled_with_cuda(): paddle.set_device("cpu") else: paddle.set_device("gpu") - world_size = paddle.distributed.get_world_size() if world_size > 1: paddle.distributed.init_parallel_env() diff --git a/examples/speedyspeech/baker/README.md b/examples/speedyspeech/baker/README.md index 144b38b..c78b806 100644 --- a/examples/speedyspeech/baker/README.md +++ b/examples/speedyspeech/baker/README.md @@ -101,7 +101,7 @@ When training is done or pretrained models are downloaded. You can run `synthesi usage: synthesize_e2e.py [-h] [--speedyspeech-config SPEEDYSPEECH_CONFIG] [--speedyspeech-checkpoint SPEEDYSPEECH_CHECKPOINT] [--speedyspeech-stat SPEEDYSPEECH_STAT] - [--pwg-config PWG_CONFIG] [--pwg-params PWG_PARAMS] + [--pwg-config PWG_CONFIG] [--pwg-params PWG_CHECKPOINT] [--pwg-stat PWG_STAT] [--text TEXT] [--output-dir OUTPUT_DIR] [--inference-dir INFERENCE_DIR] [--device DEVICE] @@ -120,7 +120,7 @@ optional arguments: spectrogram when training speedyspeech. --pwg-config PWG_CONFIG config file for parallelwavegan. - --pwg-checkpoint PWG_PARAMS + --pwg-checkpoint PWG_CHECKPOINT parallel wavegan checkpoint to load. --pwg-stat PWG_STAT mean and standard deviation used to normalize spectrogram when training speedyspeech. diff --git a/examples/speedyspeech/baker/synthesize.py b/examples/speedyspeech/baker/synthesize.py index 65fccb4..2825d26 100644 --- a/examples/speedyspeech/baker/synthesize.py +++ b/examples/speedyspeech/baker/synthesize.py @@ -49,7 +49,7 @@ def evaluate(args, speedyspeech_config, pwg_config): model.eval() vocoder = PWGGenerator(**pwg_config["generator_params"]) - vocoder.set_state_dict(paddle.load(args.pwg_params)) + vocoder.set_state_dict(paddle.load(args.pwg_checkpoint)["generator_params"]) vocoder.remove_weight_norm() vocoder.eval() print("model done!") @@ -126,7 +126,7 @@ def main(): parser.add_argument( "--pwg-config", type=str, help="config file for parallelwavegan.") parser.add_argument( - "--pwg-params", + "--pwg-checkpoint", type=str, help="parallel wavegan generator parameters to load.") parser.add_argument( diff --git a/examples/speedyspeech/baker/synthesize.sh b/examples/speedyspeech/baker/synthesize.sh index 2bca37c..b90d86b 100644 --- a/examples/speedyspeech/baker/synthesize.sh +++ b/examples/speedyspeech/baker/synthesize.sh @@ -3,7 +3,7 @@ python synthesize.py \ --speedyspeech-checkpoint=exp/default/checkpoints/snapshot_iter_91800.pdz \ --speedyspeech-stat=dump/train/stats.npy \ --pwg-config=../../parallelwave_gan/baker/conf/default.yaml \ - --pwg-params=../../parallelwave_gan/baker/converted.pdparams \ + --pwg-checkpoint=../../parallelwave_gan/baker/exp/default/checkpoints/snapshot_iter_400000.pdz \ --pwg-stat=../../parallelwave_gan/baker/dump/train/stats.npy \ --test-metadata=dump/test/norm/metadata.jsonl \ --output-dir=exp/debug/test \ diff --git a/examples/speedyspeech/baker/synthesize_e2e.sh b/examples/speedyspeech/baker/synthesize_e2e.sh index baf4ef3..f5d4139 100644 --- a/examples/speedyspeech/baker/synthesize_e2e.sh +++ b/examples/speedyspeech/baker/synthesize_e2e.sh @@ -3,7 +3,7 @@ python synthesize_e2e.py \ --speedyspeech-checkpoint=exp/debug/checkpoints/snapshot_iter_91800.pdz \ --speedyspeech-stat=dump/train/stats.npy \ --pwg-config=../../parallelwave_gan/baker/conf/default.yaml \ - --pwg-params=../../parallelwave_gan/baker/converted.pdparams \ + --pwg-checkpoint=../../parallelwave_gan/baker/exp/default/checkpoints/snapshot_iter_400000.pdz \ --pwg-stat=../../parallelwave_gan/baker/dump/train/stats.npy \ --text=sentences.txt \ --output-dir=exp/debug/e2e \ diff --git a/examples/speedyspeech/baker/train.py b/examples/speedyspeech/baker/train.py index 6f063a6..ef2aa3f 100644 --- a/examples/speedyspeech/baker/train.py +++ b/examples/speedyspeech/baker/train.py @@ -42,11 +42,11 @@ from speedyspeech_updater import SpeedySpeechUpdater, SpeedySpeechEvaluator def train_sp(args, config): # decides device type and whether to run in parallel # setup running environment correctly - if not paddle.is_compiled_with_cuda: + world_size = paddle.distributed.get_world_size() + if not paddle.is_compiled_with_cuda(): paddle.set_device("cpu") else: paddle.set_device("gpu") - world_size = paddle.distributed.get_world_size() if world_size > 1: paddle.distributed.init_parallel_env()