Skip to content

Commit a26ca1f

Browse files
yt605155624luotao1
authored andcommitted
[TTS]Fix VITS lite infer (PaddlePaddle#3098)
1 parent 7b98930 commit a26ca1f

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

examples/csmsc/vits/local/lite_predict.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ stage=0
77
stop_stage=0
88

99
if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ]; then
10-
python3 ${BIN_DIR}/../lite_predict.py \
10+
python3 ${BIN_DIR}/lite_predict.py \
1111
--inference_dir=${train_output_path}/pdlite \
1212
--am=vits_csmsc \
1313
--text=${BIN_DIR}/../sentences.txt \

examples/csmsc/vits/run.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ fi
5454
# ./local/ort_predict.sh ${train_output_path}
5555
# fi
5656

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

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

paddlespeech/t2s/exps/vits/lite_predict.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from paddlespeech.t2s.exps.lite_syn_utils import get_lite_predictor
2222
from paddlespeech.t2s.exps.syn_utils import get_frontend
2323
from paddlespeech.t2s.exps.syn_utils import get_sentences
24+
from paddlespeech.t2s.utils import str2bool
2425

2526

2627
def parse_args():
@@ -75,12 +76,12 @@ def main():
7576
# frontend
7677
frontend = get_frontend(
7778
lang=args.lang,
78-
phones_dict=args.phones_dict,
79-
tones_dict=args.tones_dict)
79+
phones_dict=args.phones_dict)
8080

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

0 commit comments

Comments
 (0)