support new inference interface (#3927)

* pir infer

* add version control

* fix
pull/3935/head
zxcd 3 weeks ago committed by GitHub
parent f582cb6299
commit c0fafd0647
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -18,6 +18,7 @@ from pathlib import Path
import soundfile as sf
from paddle import inference
import paddlespeech.utils
from paddlespeech.t2s.frontend.zh_frontend import Frontend
@ -48,16 +49,27 @@ def main():
phone_vocab_path=args.phones_dict, tone_vocab_path=args.tones_dict)
print("frontend done!")
# after paddle 3.0, support new inference interface
if paddlespeech.utils.satisfy_paddle_version('3.0.0-beta'):
speedyspeech_config = inference.Config(
str(Path(args.inference_dir)), "speedyspeech")
else:
speedyspeech_config = inference.Config(
str(Path(args.inference_dir) / "speedyspeech.pdmodel"),
str(Path(args.inference_dir) / "speedyspeech.pdiparams"))
speedyspeech_config.enable_use_gpu(100, 0)
speedyspeech_config.enable_memory_optim()
speedyspeech_predictor = inference.create_predictor(speedyspeech_config)
# after paddle 3.0, support new inference interface
if paddlespeech.utils.satisfy_paddle_version('3.0.0-beta'):
pwg_config = inference.Config(str(Path(args.inference_dir)), "pwg")
else:
pwg_config = inference.Config(
str(Path(args.inference_dir) / "pwg.pdmodel"),
str(Path(args.inference_dir) / "pwg.pdiparams"))
pwg_config.enable_use_gpu(100, 0)
pwg_config.enable_memory_optim()
pwg_predictor = inference.create_predictor(pwg_config)

Loading…
Cancel
Save