Skip to content

Commit

Permalink
[TTS]Fix VITS lite infer (PaddlePaddle#3098)
Browse files Browse the repository at this point in the history
  • Loading branch information
yt605155624 authored and luotao1 committed Jun 11, 2024
1 parent 7b98930 commit a26ca1f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
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

0 comments on commit a26ca1f

Please sign in to comment.