From d05ee1d7d5f54397d9bd22c05fdb2e28ed6a8abc Mon Sep 17 00:00:00 2001 From: chenfeiyu Date: Thu, 22 Jul 2021 19:17:00 +0800 Subject: [PATCH] load the saved model for inference --- examples/speedyspeech/baker/synthesize.py | 3 +++ examples/speedyspeech/baker/synthesize_e2e.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/examples/speedyspeech/baker/synthesize.py b/examples/speedyspeech/baker/synthesize.py index 262908f..c4b6cb3 100644 --- a/examples/speedyspeech/baker/synthesize.py +++ b/examples/speedyspeech/baker/synthesize.py @@ -85,6 +85,8 @@ def evaluate(args, speedyspeech_config, pwg_config): ]) paddle.jit.save(speedyspeech_inference, os.path.join(args.inference_dir, "speedyspeech")) + speedyspeech_inference = paddle.jit.load( + os.path.join(args.inference_dir, "speedyspeech")) pwg_inference = PWGInference(pwg_normalizer, vocoder) pwg_inference.eval() @@ -93,6 +95,7 @@ def evaluate(args, speedyspeech_config, pwg_config): input_spec=[InputSpec( [-1, 80], dtype=paddle.float32), ]) paddle.jit.save(pwg_inference, os.path.join(args.inference_dir, "pwg")) + pwg_inference = paddle.jit.load(os.path.join(args.inference_dir, "pwg")) output_dir = Path(args.output_dir) output_dir.mkdir(parents=True, exist_ok=True) diff --git a/examples/speedyspeech/baker/synthesize_e2e.py b/examples/speedyspeech/baker/synthesize_e2e.py index 186230c..af448c8 100644 --- a/examples/speedyspeech/baker/synthesize_e2e.py +++ b/examples/speedyspeech/baker/synthesize_e2e.py @@ -86,6 +86,8 @@ def evaluate(args, speedyspeech_config, pwg_config): ]) paddle.jit.save(speedyspeech_inference, os.path.join(args.inference_dir, "speedyspeech")) + speedyspeech_inference = paddle.jit.load( + os.path.join(args.inference_dir, "speedyspeech")) pwg_inference = PWGInference(pwg_normalizer, vocoder) pwg_inference.eval() @@ -94,6 +96,7 @@ def evaluate(args, speedyspeech_config, pwg_config): input_spec=[InputSpec( [-1, 80], dtype=paddle.float32), ]) paddle.jit.save(pwg_inference, os.path.join(args.inference_dir, "pwg")) + pwg_inference = paddle.jit.load(os.path.join(args.inference_dir, "pwg")) output_dir = Path(args.output_dir) output_dir.mkdir(parents=True, exist_ok=True)