From 07279848736a592d5e0733baefb947283699b71b Mon Sep 17 00:00:00 2001 From: TianYuan Date: Wed, 9 Nov 2022 19:43:29 +0800 Subject: [PATCH] Add export2lite, test=tts (#2636) --- examples/aishell3/tts3/local/export2lite.sh | 1 + examples/aishell3/tts3/run.sh | 10 +++++++ examples/csmsc/tts2/local/export2lite.sh | 1 + examples/csmsc/tts2/run.sh | 13 +++++++++ examples/csmsc/tts3/local/export2lite.sh | 18 ++++++++++++ examples/csmsc/tts3/run.sh | 13 +++++++++ examples/csmsc/tts3/run_cnndecoder.sh | 32 ++++++++++++++++++++- examples/ljspeech/tts3/local/export2lite.sh | 1 + examples/ljspeech/tts3/run.sh | 11 +++++++ examples/vctk/tts3/local/export2lite.sh | 1 + examples/vctk/tts3/run.sh | 11 +++++++ 11 files changed, 111 insertions(+), 1 deletion(-) create mode 120000 examples/aishell3/tts3/local/export2lite.sh create mode 120000 examples/csmsc/tts2/local/export2lite.sh create mode 100755 examples/csmsc/tts3/local/export2lite.sh create mode 120000 examples/ljspeech/tts3/local/export2lite.sh create mode 120000 examples/vctk/tts3/local/export2lite.sh diff --git a/examples/aishell3/tts3/local/export2lite.sh b/examples/aishell3/tts3/local/export2lite.sh new file mode 120000 index 00000000..f7719914 --- /dev/null +++ b/examples/aishell3/tts3/local/export2lite.sh @@ -0,0 +1 @@ +../../../csmsc/tts3/local/export2lite.sh \ No newline at end of file diff --git a/examples/aishell3/tts3/run.sh b/examples/aishell3/tts3/run.sh index f730f376..90b34212 100755 --- a/examples/aishell3/tts3/run.sh +++ b/examples/aishell3/tts3/run.sh @@ -58,3 +58,13 @@ fi if [ ${stage} -le 6 ] && [ ${stop_stage} -ge 6 ]; then ./local/ort_predict.sh ${train_output_path} fi + +if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then + # This model is not supported, because 3 ops are not supported on 'arm'. These unsupported ops are: 'round, set_value, share_data'. + # This model is not supported, because 4 ops are not supported on 'x86'. These unsupported ops are: 'matmul_v2, round, set_value, share_data'. + # ./local/export2lite.sh ${train_output_path} inference pdlite fastspeech2_aishell3 x86 + # x86 ok, arm Segmentation fault + # ./local/export2lite.sh ${train_output_path} inference pdlite pwgan_aishell3 x86 + # x86 ok, arm ok + ./local/export2lite.sh ${train_output_path} inference pdlite hifigan_aishell3 x86 +fi diff --git a/examples/csmsc/tts2/local/export2lite.sh b/examples/csmsc/tts2/local/export2lite.sh new file mode 120000 index 00000000..402fd833 --- /dev/null +++ b/examples/csmsc/tts2/local/export2lite.sh @@ -0,0 +1 @@ +../../tts3/local/export2lite.sh \ No newline at end of file diff --git a/examples/csmsc/tts2/run.sh b/examples/csmsc/tts2/run.sh index 557dd4ff..75fdb210 100755 --- a/examples/csmsc/tts2/run.sh +++ b/examples/csmsc/tts2/run.sh @@ -60,3 +60,16 @@ fi if [ ${stage} -le 6 ] && [ ${stop_stage} -ge 6 ]; then ./local/ort_predict.sh ${train_output_path} fi + +# must run after stage 3 (which stage generated static models) +if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then + # This model is not supported, because 3 ops are not supported on 'arm'. These unsupported ops are: 'round, set_value, share_data'. + # This model is not supported, because 4 ops are not supported on 'x86'. These unsupported ops are: 'matmul_v2, round, set_value, share_data'. + ./local/export2lite.sh ${train_output_path} inference pdlite speedyspeech_csmsc x86 + # x86 ok, arm Segmentation fault + # ./local/export2lite.sh ${train_output_path} inference pdlite pwgan_csmsc x86 + # x86 ok, arm Segmentation fault + # ./local/export2lite.sh ${train_output_path} inference pdlite mb_melgan_csmsc x86 + # x86 ok, arm ok + # ./local/export2lite.sh ${train_output_path} inference pdlite hifigan_csmsc x86 +fi diff --git a/examples/csmsc/tts3/local/export2lite.sh b/examples/csmsc/tts3/local/export2lite.sh new file mode 100755 index 00000000..f99905cf --- /dev/null +++ b/examples/csmsc/tts3/local/export2lite.sh @@ -0,0 +1,18 @@ +train_output_path=$1 +model_dir=$2 +output_dir=$3 +model=$4 +valid_targets=$5 + +model_name=${model%_*} +echo model_name: ${model_name} + + + +mkdir -p ${train_output_path}/${output_dir} + +paddle_lite_opt \ + --model_file ${train_output_path}/${model_dir}/${model}.pdmodel \ + --param_file ${train_output_path}/${model_dir}/${model}.pdiparams \ + --optimize_out ${train_output_path}/${output_dir}/${model}_${valid_targets} \ + --valid_targets ${valid_targets} diff --git a/examples/csmsc/tts3/run.sh b/examples/csmsc/tts3/run.sh index 80acf820..8d646ecc 100755 --- a/examples/csmsc/tts3/run.sh +++ b/examples/csmsc/tts3/run.sh @@ -61,3 +61,16 @@ fi if [ ${stage} -le 6 ] && [ ${stop_stage} -ge 6 ]; then ./local/ort_predict.sh ${train_output_path} fi + +# must run after stage 3 (which stage generated static models) +if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then + # This model is not supported, because 3 ops are not supported on 'arm'. These unsupported ops are: 'round, set_value, share_data'. + # This model is not supported, because 4 ops are not supported on 'x86'. These unsupported ops are: 'matmul_v2, round, set_value, share_data'. + ./local/export2lite.sh ${train_output_path} inference pdlite fastspeech2_csmsc x86 + # x86 ok, arm Segmentation fault + # ./local/export2lite.sh ${train_output_path} inference pdlite pwgan_csmsc x86 + # x86 ok, arm Segmentation fault + # ./local/export2lite.sh ${train_output_path} inference pdlite mb_melgan_csmsc x86 + # x86 ok, arm ok + # ./local/export2lite.sh ${train_output_path} inference pdlite hifigan_csmsc x86 +fi diff --git a/examples/csmsc/tts3/run_cnndecoder.sh b/examples/csmsc/tts3/run_cnndecoder.sh index bae83315..645d1af0 100755 --- a/examples/csmsc/tts3/run_cnndecoder.sh +++ b/examples/csmsc/tts3/run_cnndecoder.sh @@ -75,7 +75,6 @@ if [ ${stage} -le 8 ] && [ ${stop_stage} -ge 8 ]; then fi # paddle2onnx streaming - if [ ${stage} -le 9 ] && [ ${stop_stage} -ge 9 ]; then # install paddle2onnx version=$(echo `pip list |grep "paddle2onnx"` |awk -F" " '{print $2}') @@ -97,3 +96,34 @@ if [ ${stage} -le 10 ] && [ ${stop_stage} -ge 10 ]; then ./local/ort_predict_streaming.sh ${train_output_path} fi +# must run after stage 3 (which stage generated static models) +if [ ${stage} -le 11 ] && [ ${stop_stage} -ge 11 ]; then + # This model is not supported, because 3 ops are not supported on 'arm'. These unsupported ops are: 'round, set_value, share_data'. + # This model is not supported, because 4 ops are not supported on 'x86'. These unsupported ops are: 'matmul_v2, round, set_value, share_data'. + ./local/export2lite.sh ${train_output_path} inference pdlite fastspeech2_csmsc x86 + # x86 ok, arm Segmentation fault + # ./local/export2lite.sh ${train_output_path} inference pdlite pwgan_csmsc x86 + # x86 ok, arm Segmentation fault + # ./local/export2lite.sh ${train_output_path} inference pdlite mb_melgan_csmsc x86 + # x86 ok, arm ok + # ./local/export2lite.sh ${train_output_path} inference pdlite hifigan_csmsc x86 +fi + +# must run after stage 5 (which stage generated static models) +if [ ${stage} -le 12 ] && [ ${stop_stage} -ge 12 ]; then + # streaming acoustic model + # This model is not supported, because 3 ops are not supported on 'arm'. These unsupported ops are: 'round, set_value, share_data'. + # This model is not supported, because 4 ops are not supported on 'x86'. These unsupported ops are: 'matmul_v2, round, set_value, share_data'. + # ./local/export2lite.sh ${train_output_path} inference pdlite fastspeech2_csmsc x86 + ./local/export2lite.sh ${train_output_path} inference_streaming pdlite_streaming fastspeech2_csmsc_am_encoder_infer x86 + # x86 ok, arm Segmentation fault + ./local/export2lite.sh ${train_output_path} inference_streaming pdlite_streaming fastspeech2_csmsc_am_decoder x86 + # x86 ok, arm Segmentation fault + ./local/export2lite.sh ${train_output_path} inference_streaming pdlite_streaming fastspeech2_csmsc_am_postnet x86 + # x86 ok, arm Segmentation fault + # ./local/export2lite.sh ${train_output_path} inference_streaming pdlite_streaming pwgan_csmsc x86 + # x86 ok, arm Segmentation fault + # ./local/export2lite.sh ${train_output_path} inference_streaming pdlite_streaming mb_melgan_csmsc x86 + # x86 ok, arm ok + # ./local/export2lite.sh ${train_output_path} inference_streaming pdlite_streaming hifigan_csmsc x86 +fi diff --git a/examples/ljspeech/tts3/local/export2lite.sh b/examples/ljspeech/tts3/local/export2lite.sh new file mode 120000 index 00000000..f7719914 --- /dev/null +++ b/examples/ljspeech/tts3/local/export2lite.sh @@ -0,0 +1 @@ +../../../csmsc/tts3/local/export2lite.sh \ No newline at end of file diff --git a/examples/ljspeech/tts3/run.sh b/examples/ljspeech/tts3/run.sh index 95618593..7ab59186 100755 --- a/examples/ljspeech/tts3/run.sh +++ b/examples/ljspeech/tts3/run.sh @@ -59,3 +59,14 @@ fi if [ ${stage} -le 6 ] && [ ${stop_stage} -ge 6 ]; then ./local/ort_predict.sh ${train_output_path} fi + +# must run after stage 3 (which stage generated static models) +if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then + # This model is not supported, because 3 ops are not supported on 'arm'. These unsupported ops are: 'round, set_value, share_data'. + # This model is not supported, because 4 ops are not supported on 'x86'. These unsupported ops are: 'matmul_v2, round, set_value, share_data'. + ./local/export2lite.sh ${train_output_path} inference pdlite fastspeech2_ljspeech x86 + # x86 ok, arm Segmentation fault + # ./local/export2lite.sh ${train_output_path} inference pdlite pwgan_ljspeech x86 + # x86 ok, arm ok + # ./local/export2lite.sh ${train_output_path} inference pdlite hifigan_ljspeech x86 +fi \ No newline at end of file diff --git a/examples/vctk/tts3/local/export2lite.sh b/examples/vctk/tts3/local/export2lite.sh new file mode 120000 index 00000000..f7719914 --- /dev/null +++ b/examples/vctk/tts3/local/export2lite.sh @@ -0,0 +1 @@ +../../../csmsc/tts3/local/export2lite.sh \ No newline at end of file diff --git a/examples/vctk/tts3/run.sh b/examples/vctk/tts3/run.sh index b5184aed..16f1eae1 100755 --- a/examples/vctk/tts3/run.sh +++ b/examples/vctk/tts3/run.sh @@ -58,3 +58,14 @@ fi if [ ${stage} -le 6 ] && [ ${stop_stage} -ge 6 ]; then ./local/ort_predict.sh ${train_output_path} fi + +# must run after stage 3 (which stage generated static models) +if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then + # This model is not supported, because 3 ops are not supported on 'arm'. These unsupported ops are: 'round, set_value, share_data'. + # This model is not supported, because 4 ops are not supported on 'x86'. These unsupported ops are: 'matmul_v2, round, set_value, share_data'. + ./local/export2lite.sh ${train_output_path} inference pdlite fastspeech2_vctk x86 + # x86 ok, arm Segmentation fault + # ./local/export2lite.sh ${train_output_path} inference pdlite pwgan_vctk x86 + # x86 ok, arm ok + # ./local/export2lite.sh ${train_output_path} inference pdlite hifigan_vctk x86 +fi