avg.sh 405 字节
Newer Older
1 2
#! /usr/bin/env bash

H
Hui Zhang 已提交
3
if [ $# != 2 ]; then
4 5 6 7 8 9 10 11 12 13 14 15 16
    echo "usage: ${0} ckpt_dir avg_num"
    exit -1
fi

ckpt_dir=${1}
average_num=${2}
decode_checkpoint=${ckpt_dir}/avg_${average_num}.pdparams

python3 -u ${MAIN_ROOT}/utils/avg_model.py \
--dst_model ${decode_checkpoint} \
--ckpt_dir ${ckpt_dir}  \
--num ${average_num} \
--val_best
H
Hui Zhang 已提交
17

18 19 20 21 22
if [ $? -ne 0 ]; then
    echo "Failed in avg ckpt!"
    exit 1
fi

H
Hui Zhang 已提交
23
exit 0