You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.8 KiB
56 lines
1.8 KiB
#!/bin/bash
|
|
set -e
|
|
source path.sh
|
|
|
|
gpus=0,1,2,3
|
|
stage=0
|
|
stop_stage=100
|
|
conf_path=conf/deepspeech2.yaml #conf/deepspeech2.yaml or conf/deepspeech2_online.yaml
|
|
ips= #xx.xx.xx.xx,xx.xx.xx.xx
|
|
decode_conf_path=conf/tuning/decode.yaml
|
|
avg_num=10
|
|
audio_file=data/demo_01_03.wav
|
|
|
|
source ${MAIN_ROOT}/utils/parse_options.sh || exit 1;
|
|
|
|
avg_ckpt=avg_${avg_num}
|
|
ckpt=$(basename ${conf_path} | awk -F'.' '{print $1}')
|
|
echo "checkpoint name ${ckpt}"
|
|
|
|
|
|
if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ]; then
|
|
# prepare data
|
|
bash ./local/data.sh || exit -1
|
|
fi
|
|
|
|
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
|
|
# train model, all `ckpt` under `exp` dir
|
|
CUDA_VISIBLE_DEVICES=${gpus} ./local/train.sh ${conf_path} ${ckpt} ${ips}
|
|
fi
|
|
|
|
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
|
|
# avg n best model
|
|
avg.sh best exp/${ckpt}/checkpoints ${avg_num}
|
|
fi
|
|
|
|
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
|
|
# test ckpt avg_n
|
|
CUDA_VISIBLE_DEVICES=0 ./local/test.sh ${conf_path} ${decode_conf_path} exp/${ckpt}/checkpoints/${avg_ckpt}|| exit -1
|
|
fi
|
|
|
|
if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then
|
|
# export ckpt avg_n
|
|
CUDA_VISIBLE_DEVICES=0 ./local/export.sh ${conf_path} exp/${ckpt}/checkpoints/${avg_ckpt} exp/${ckpt}/checkpoints/${avg_ckpt}.jit
|
|
fi
|
|
|
|
if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then
|
|
# test export ckpt avg_n
|
|
CUDA_VISIBLE_DEVICES=0 ./local/test_export.sh ${conf_path} ${decode_conf_path} exp/${ckpt}/checkpoints/${avg_ckpt}.jit|| exit -1
|
|
fi
|
|
|
|
# Optionally, you can add LM and test it with runtime.
|
|
if [ ${stage} -le 6 ] && [ ${stop_stage} -ge 6 ]; then
|
|
# test a single .wav file
|
|
CUDA_VISIBLE_DEVICES=0 ./local/test_wav.sh ${conf_path} ${decode_conf_path} exp/${ckpt}/checkpoints/${avg_ckpt} ${audio_file} || exit -1
|
|
fi
|