run.sh 1.1 KB
Newer Older
H
Hui Zhang 已提交
1
#!/bin/bash
H
Hui Zhang 已提交
2
set -e
H
Hui Zhang 已提交
3 4
source path.sh

H
Hui Zhang 已提交
5 6 7 8 9 10 11
stage=0
stop_stage=100
conf_path=conf/conformer.yaml
avg_num=20

source ${MAIN_ROOT}/utils/parse_options.sh || exit 1;

H
Hui Zhang 已提交
12 13 14 15
avg_ckpt=avg_${avg_num}
ckpt=$(basename ${conf_path} | awk -F'.' '{print $1}')
echo "checkpoint name ${ckpt}"

H
Hui Zhang 已提交
16 17 18 19
if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ]; then
    # prepare data
    bash ./local/data.sh || exit -1
fi
H
Hui Zhang 已提交
20

H
Hui Zhang 已提交
21 22 23 24
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
    # train model, all `ckpt` under `exp` dir
    CUDA_VISIBLE_DEVICES=0,1,2,3 ./local/train.sh ${conf_path}  ${ckpt}
fi
H
Hui Zhang 已提交
25

H
Hui Zhang 已提交
26 27 28 29
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
    # avg n best model
    ./local/avg.sh exp/${ckpt}/checkpoints ${avg_num}
fi
H
Hui Zhang 已提交
30

H
Hui Zhang 已提交
31 32 33 34
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then
    # test ckpt avg_n
    CUDA_VISIBLE_DEVICES=4 ./local/test.sh ${conf_path} exp/${ckpt}/checkpoints/${avg_ckpt} || exit -1
fi
H
Hui Zhang 已提交
35

H
Hui Zhang 已提交
36 37 38 39
if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then
    # export ckpt avg_n
    CUDA_VISIBLE_DEVICES= ./local/export.sh ${conf_path} exp/${ckpt}/checkpoints/${avg_ckpt} exp/${ckpt}/checkpoints/${avg_ckpt}.jit
fi