Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TTS]Fix VITS lite infer #3098

Merged
merged 3 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/csmsc/vits/local/lite_predict.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ stage=0
stop_stage=0

if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ]; then
python3 ${BIN_DIR}/../lite_predict.py \
python3 ${BIN_DIR}/lite_predict.py \
--inference_dir=${train_output_path}/pdlite \
--am=vits_csmsc \
--text=${BIN_DIR}/../sentences.txt \
Expand Down
22 changes: 11 additions & 11 deletions examples/csmsc/vits/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ fi
# ./local/ort_predict.sh ${train_output_path}
# fi

# # not ready yet for operator missing in Paddle-Lite
# # must run after stage 3 (which stage generated static models)
# if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then
# # NOTE by yuantian 2022.11.21: please compile develop version of Paddle-Lite to export and run TTS models,
# # cause TTS models are supported by https://github.com/PaddlePaddle/Paddle-Lite/pull/9587
# # and https://github.com/PaddlePaddle/Paddle-Lite/pull/9706
# ./local/export2lite.sh ${train_output_path} inference pdlite vits_csmsc x86
# fi
# not ready yet for operator missing in Paddle-Lite
# must run after stage 3 (which stage generated static models)
if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then
# NOTE by yuantian 2022.11.21: please compile develop version of Paddle-Lite to export and run TTS models,
# cause TTS models are supported by https://github.com/PaddlePaddle/Paddle-Lite/pull/10128
# vits can only run in arm
./local/export2lite.sh ${train_output_path} inference pdlite vits_csmsc arm
fi

# if [ ${stage} -le 8 ] && [ ${stop_stage} -ge 8 ]; then
# CUDA_VISIBLE_DEVICES=${gpus} ./local/lite_predict.sh ${train_output_path} || exit -1
# fi
if [ ${stage} -le 8 ] && [ ${stop_stage} -ge 8 ]; then
CUDA_VISIBLE_DEVICES=${gpus} ./local/lite_predict.sh ${train_output_path} || exit -1
fi

7 changes: 4 additions & 3 deletions paddlespeech/t2s/exps/vits/lite_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from paddlespeech.t2s.exps.lite_syn_utils import get_lite_predictor
from paddlespeech.t2s.exps.syn_utils import get_frontend
from paddlespeech.t2s.exps.syn_utils import get_sentences
from paddlespeech.t2s.utils import str2bool


def parse_args():
Expand Down Expand Up @@ -75,12 +76,12 @@ def main():
# frontend
frontend = get_frontend(
lang=args.lang,
phones_dict=args.phones_dict,
tones_dict=args.tones_dict)
phones_dict=args.phones_dict)

# am_predictor
# vits can only run in arm
am_predictor = get_lite_predictor(
model_dir=args.inference_dir, model_file=args.am + "_x86.nb")
model_dir=args.inference_dir, model_file=args.am + "_arm.nb")
# model: {model_name}_{dataset}
am_dataset = args.am[args.am.rindex('_') + 1:]

Expand Down