load the saved model for inference

This commit is contained in:
chenfeiyu 2021-07-22 19:17:00 +08:00
parent 133294340c
commit d05ee1d7d5
2 changed files with 6 additions and 0 deletions

View File

@ -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)

View File

@ -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)