- CPU: sh run_trian.sh CPU [DATASET_PATH] [CKPT_PATH] [FREEZE_LAYER]
- CPU: sh run_trian.sh CPU [DATASET_PATH] [CKPT_PATH] [FREEZE_LAYER] [FILTER_HEAD]
`CKPT_PATH``FREEZE_LAYER` and `FILTER_HEAD` are optional, when set `CKPT_PATH`, `FREEZE_LAYER` must be set. `FREEZE_LAYER` should be in ["none", "backbone"], and if you set `FREEZE_LAYER`="backbone", the parameter in backbone will be freezed when training and the parameter in head will not be load from checkpoint. if `FILTER_HEAD`=True, the parameter in head will not be load from checkpoint.
> RANK_TABLE_FILE is HCCL configuration file when running on Ascend.
> RANK_TABLE_FILE is HCCL configuration file when running on Ascend.
> The common restrictions on using the distributed service are as follows. For details, see the HCCL documentation.
> The common restrictions on using the distributed service are as follows. For details, see the HCCL documentation.
@ -113,14 +115,14 @@ You can start training using python or shell scripts. The usage of shell scripts
Ascend: sh run_train.sh Ascend [DEVICE_NUM][VISIABLE_DEVICES(0,1,2,3,4,5,6,7)][RANK_TABLE_FILE][DATASET_PATH][CKPT_PATH](optional)[FREEZE_LAYER](optional)[FILTER_HEAD](optional)
Ascend: sh run_train.sh Ascend [DEVICE_NUM][VISIABLE_DEVICES(0,1,2,3,4,5,6,7)][RANK_TABLE_FILE][DATASET_PATH]"
exit1
fi;
if[$2 -lt 1]&&[$2 -gt 8]
if[$2 -lt 1]&&[$2 -gt 8]
then
then
echo"error: DEVICE_NUM=$2 is not in (1-8)"
echo"error: DEVICE_NUM=$2 is not in (1-8)"
@ -59,8 +78,9 @@ run_ascend()
python train.py \
python train.py \
--platform=$1\
--platform=$1\
--dataset_path=$5\
--dataset_path=$5\
--pretrain_ckpt=$6\
--pretrain_ckpt=$PRETRAINED_CKPT\
--freeze_layer=$7\
--freeze_layer=$FREEZE_LAYER\
--filter_head=$FILTER_HEAD\
&> log$i.log &
&> log$i.log &
cd ..
cd ..
done
done
@ -68,6 +88,24 @@ run_ascend()
run_gpu()
run_gpu()
{
{
if[$#=4];then
PRETRAINED_CKPT=""
FREEZE_LAYER="none"
FILTER_HEAD="False"
elif[$#=6];then
PRETRAINED_CKPT=$5
FREEZE_LAYER=$6
FILTER_HEAD="False"
elif[$#=7];then
PRETRAINED_CKPT=$5
FREEZE_LAYER=$6
FILTER_HEAD=$7
else
echo"Usage:
GPU: sh run_train.sh GPU [DEVICE_NUM][VISIABLE_DEVICES(0,1,2,3,4,5,6,7)][DATASET_PATH][CKPT_PATH](optional)[FREEZE_LAYER](optional)[FILTER_HEAD](optional)
GPU: sh run_train.sh GPU [DEVICE_NUM][VISIABLE_DEVICES(0,1,2,3,4,5,6,7)][DATASET_PATH]"
exit1
fi;
if[$2 -lt 1]&&[$2 -gt 8]
if[$2 -lt 1]&&[$2 -gt 8]
then
then
echo"error: DEVICE_NUM=$2 is not in (1-8)"
echo"error: DEVICE_NUM=$2 is not in (1-8)"
@ -94,14 +132,32 @@ run_gpu()
python ${BASEPATH}/../train.py \
python ${BASEPATH}/../train.py \
--platform=$1\
--platform=$1\
--dataset_path=$4\
--dataset_path=$4\
--pretrain_ckpt=$5\
--pretrain_ckpt=$PRETRAINED_CKPT\
--freeze_layer=$6\
--freeze_layer=$FREEZE_LAYER\
--filter_head=$FILTER_HEAD\
&> ../train.log &# dataset train folder
&> ../train.log &# dataset train folder
}
}
run_cpu()
run_cpu()
{
{
if[$#=2];then
PRETRAINED_CKPT=""
FREEZE_LAYER="none"
FILTER_HEAD="False"
elif[$#=4];then
PRETRAINED_CKPT=$3
FREEZE_LAYER=$4
FILTER_HEAD="False"
elif[$#=5];then
PRETRAINED_CKPT=$3
FREEZE_LAYER=$4
FILTER_HEAD=$5
else
echo"Usage:
CPU: sh run_train.sh CPU [DATASET_PATH]
CPU: sh run_train.sh CPU [DATASET_PATH][CKPT_PATH](optional)[FREEZE_LAYER](optional)[FILTER_HEAD](optional)"
exit1
fi;
if[ ! -d $2]
if[ ! -d $2]
then
then
echo"error: DATASET_PATH=$2 is not a directory"
echo"error: DATASET_PATH=$2 is not a directory"
@ -120,22 +176,12 @@ run_cpu()
python ${BASEPATH}/../train.py \
python ${BASEPATH}/../train.py \
--platform=$1\
--platform=$1\
--dataset_path=$2\
--dataset_path=$2\
--pretrain_ckpt=$3\
--pretrain_ckpt=$PRETRAINED_CKPT\
--freeze_layer=$4\
--freeze_layer=$FREEZE_LAYER\
--filter_head=$FILTER_HEAD\
&> ../train.log &# dataset train folder
&> ../train.log &# dataset train folder
}
}
if[$# -gt 7]||[$# -lt 4]
then
echo"Usage:
Ascend: sh run_train.sh Ascend [DEVICE_NUM][VISIABLE_DEVICES(0,1,2,3,4,5,6,7)][RANK_TABLE_FILE][DATASET_PATH][CKPT_PATH][FREEZE_LAYER]
Ascend: sh run_train.sh Ascend [DEVICE_NUM][VISIABLE_DEVICES(0,1,2,3,4,5,6,7)][RANK_TABLE_FILE][DATASET_PATH]
GPU: sh run_train.sh GPU [DEVICE_NUM][VISIABLE_DEVICES(0,1,2,3,4,5,6,7)][DATASET_PATH][CKPT_PATH][FREEZE_LAYER]
GPU: sh run_train.sh GPU [DEVICE_NUM][VISIABLE_DEVICES(0,1,2,3,4,5,6,7)][DATASET_PATH]
CPU: sh run_train.sh CPU [DATASET_PATH][CKPT_PATH][FREEZE_LAYER]"