parent
080b63f0e1
commit
c403b4412a
@ -0,0 +1,63 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
train_output_path=$1
|
||||||
|
|
||||||
|
stage=0
|
||||||
|
stop_stage=0
|
||||||
|
|
||||||
|
# pwgan
|
||||||
|
if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ]; then
|
||||||
|
python3 ${BIN_DIR}/../inference.py \
|
||||||
|
--inference_dir=${train_output_path}/inference \
|
||||||
|
--am=fastspeech2_canton \
|
||||||
|
--voc=pwgan_aishell3 \
|
||||||
|
--spk_id=10 \
|
||||||
|
--text=${BIN_DIR}/../sentences_canton.txt \
|
||||||
|
--output_dir=${train_output_path}/pd_infer_out \
|
||||||
|
--phones_dict=dump/phone_id_map.txt \
|
||||||
|
--speaker_dict=dump/speaker_id_map.txt \
|
||||||
|
--lang=canton \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# for more GAN Vocoders
|
||||||
|
# multi band melgan
|
||||||
|
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
||||||
|
python3 ${BIN_DIR}/../inference.py \
|
||||||
|
--inference_dir=${train_output_path}/inference \
|
||||||
|
--am=fastspeech2_canton \
|
||||||
|
--voc=mb_melgan_csmsc \
|
||||||
|
--spk_id=10 \
|
||||||
|
--text=${BIN_DIR}/../sentences_canton.txt \
|
||||||
|
--output_dir=${train_output_path}/pd_infer_out \
|
||||||
|
--phones_dict=dump/phone_id_map.txt \
|
||||||
|
--speaker_dict=dump/speaker_id_map.txt \
|
||||||
|
--lang=canton \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# hifigan
|
||||||
|
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
||||||
|
python3 ${BIN_DIR}/../inference.py \
|
||||||
|
--inference_dir=${train_output_path}/inference \
|
||||||
|
--am=fastspeech2_canton \
|
||||||
|
--voc=hifigan_csmsc \
|
||||||
|
--spk_id=10 \
|
||||||
|
--text=${BIN_DIR}/../sentences_canton.txt \
|
||||||
|
--output_dir=${train_output_path}/pd_infer_out \
|
||||||
|
--phones_dict=dump/phone_id_map.txt \
|
||||||
|
--speaker_dict=dump/speaker_id_map.txt \
|
||||||
|
--lang=canton \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# wavernn
|
||||||
|
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
|
||||||
|
python3 ${BIN_DIR}/../inference.py \
|
||||||
|
--inference_dir=${train_output_path}/inference \
|
||||||
|
--am=fastspeech2_canton \
|
||||||
|
--voc=wavernn_csmsc \
|
||||||
|
--spk_id=10 \
|
||||||
|
--text=${BIN_DIR}/../sentences_canton.txt \
|
||||||
|
--output_dir=${train_output_path}/pd_infer_out \
|
||||||
|
--phones_dict=dump/phone_id_map.txt \
|
||||||
|
--speaker_dict=dump/speaker_id_map.txt \
|
||||||
|
--lang=canton \
|
||||||
|
fi
|
@ -0,0 +1,61 @@
|
|||||||
|
train_output_path=$1
|
||||||
|
|
||||||
|
stage=0
|
||||||
|
stop_stage=0
|
||||||
|
|
||||||
|
# e2e, synthesize from text
|
||||||
|
if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ]; then
|
||||||
|
python3 ${BIN_DIR}/../ort_predict_e2e.py \
|
||||||
|
--inference_dir=${train_output_path}/inference_onnx \
|
||||||
|
--am=fastspeech2_canton \
|
||||||
|
--voc=pwgan_aishell3 \
|
||||||
|
--spk_id=10 \
|
||||||
|
--output_dir=${train_output_path}/onnx_infer_out_e2e \
|
||||||
|
--text=${BIN_DIR}/../sentences_canton.txt \
|
||||||
|
--phones_dict=dump/phone_id_map.txt \
|
||||||
|
--speaker_dict=dump/speaker_id_map.txt \
|
||||||
|
--lang=canton \
|
||||||
|
--device=cpu \
|
||||||
|
--cpu_threads=2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
||||||
|
python3 ${BIN_DIR}/../ort_predict_e2e.py \
|
||||||
|
--inference_dir=${train_output_path}/inference_onnx \
|
||||||
|
--am=fastspeech2_canton \
|
||||||
|
--voc=mb_melgan_csmsc \
|
||||||
|
--spk_id=10 \
|
||||||
|
--output_dir=${train_output_path}/onnx_infer_out_e2e \
|
||||||
|
--text=${BIN_DIR}/../sentences_canton.txt \
|
||||||
|
--phones_dict=dump/phone_id_map.txt \
|
||||||
|
--speaker_dict=dump/speaker_id_map.txt \
|
||||||
|
--lang=canton \
|
||||||
|
--device=cpu \
|
||||||
|
--cpu_threads=2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
||||||
|
python3 ${BIN_DIR}/../ort_predict_e2e.py \
|
||||||
|
--inference_dir=${train_output_path}/inference_onnx \
|
||||||
|
--am=fastspeech2_canton \
|
||||||
|
--voc=hifigan_csmsc \
|
||||||
|
--output_dir=${train_output_path}/onnx_infer_out_e2e \
|
||||||
|
--text=${BIN_DIR}/../sentences_canton.txt \
|
||||||
|
--phones_dict=dump/phone_id_map.txt \
|
||||||
|
--speaker_dict=dump/speaker_id_map.txt \
|
||||||
|
--lang=canton \
|
||||||
|
--device=cpu \
|
||||||
|
--cpu_threads=2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# synthesize from metadata, take hifigan as an example
|
||||||
|
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
|
||||||
|
python3 ${BIN_DIR}/../ort_predict.py \
|
||||||
|
--inference_dir=${train_output_path}/inference_onnx \
|
||||||
|
--am=fastspeech2_canton \
|
||||||
|
--voc=hifigan_csmsc \
|
||||||
|
--test_metadata=dump/test/norm/metadata.jsonl \
|
||||||
|
--output_dir=${train_output_path}/onnx_infer_out \
|
||||||
|
--device=cpu \
|
||||||
|
--cpu_threads=2
|
||||||
|
fi
|
@ -0,0 +1,23 @@
|
|||||||
|
train_output_path=$1
|
||||||
|
model_dir=$2
|
||||||
|
output_dir=$3
|
||||||
|
model=$4
|
||||||
|
|
||||||
|
enable_dev_version=True
|
||||||
|
|
||||||
|
model_name=${model%_*}
|
||||||
|
echo model_name: ${model_name}
|
||||||
|
|
||||||
|
if [ ${model_name} = 'mb_melgan' ] ;then
|
||||||
|
enable_dev_version=False
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p ${train_output_path}/${output_dir}
|
||||||
|
|
||||||
|
paddle2onnx \
|
||||||
|
--model_dir ${train_output_path}/${model_dir} \
|
||||||
|
--model_filename ${model}.pdmodel \
|
||||||
|
--params_filename ${model}.pdiparams \
|
||||||
|
--save_file ${train_output_path}/${output_dir}/${model}.onnx \
|
||||||
|
--opset_version 11 \
|
||||||
|
--enable_dev_version ${enable_dev_version}
|
Loading…
Reference in new issue