From 3e2330fbe1059008a1743e8de78dd0d411d35246 Mon Sep 17 00:00:00 2001 From: shangliang Xu Date: Mon, 1 Aug 2022 10:52:04 +0800 Subject: [PATCH] [TIPC] alter some params in train_benchmark txt (#6531) --- test_tipc/benchmark_train.sh | 32 ++++++++++++++++--- ...le_detr_r50_1x_coco_train_infer_python.txt | 1 + ...cnn_r50_fpn_1x_coco_train_infer_python.txt | 1 + ...cos_r50_fpn_1x_coco_train_infer_python.txt | 1 + ...gfl_r50_fpn_1x_coco_train_infer_python.txt | 1 + ...hrnet_hrnet_w32_512_train_infer_python.txt | 1 + .../hrnet_w32_256x192_train_infer_python.txt | 1 + .../tinypose_128x96_train_infer_python.txt | 3 +- ...sk_rcnn_r50_1x_coco_train_infer_python.txt | 6 ---- ...cnn_r50_fpn_1x_coco_train_infer_python.txt | 1 + ..._dla34_30e_1088x608_train_infer_python.txt | 3 +- ...knet53_30e_1088x608_train_infer_python.txt | 1 + ...lcnet_1_5x_416_coco_train_infer_python.txt | 1 + ...et_s_320_coco_lcnet_train_infer_python.txt | 1 + .../picodet_s_320_coco_train_infer_python.txt | 1 + ...olo_mbv3_large_coco_train_infer_python.txt | 1 + ...o_r50vd_dcn_1x_coco_train_infer_python.txt | 1 + ...yolo_tiny_650e_coco_train_infer_python.txt | 1 + ...r50vd_dcn_365e_coco_train_infer_python.txt | 1 + ...loe_crn_s_300e_coco_train_infer_python.txt | 1 + ...ov2_r50_fpn_1x_coco_train_infer_python.txt | 1 + ...darknet53_270e_coco_train_infer_python.txt | 1 + test_tipc/prepare.sh | 3 +- test_tipc/test_train_inference_python.sh | 11 ++++--- 24 files changed, 57 insertions(+), 19 deletions(-) diff --git a/test_tipc/benchmark_train.sh b/test_tipc/benchmark_train.sh index 3e5cb9efc..dd7471d03 100644 --- a/test_tipc/benchmark_train.sh +++ b/test_tipc/benchmark_train.sh @@ -23,6 +23,18 @@ function func_parser_params(){ echo ${tmp} } +function set_dynamic_epoch(){ + string=$1 + num=$2 + _str=${string:1:6} + IFS="C" + arr=(${_str}) + M=${arr[0]} + P=${arr[1]} + ep=`expr $num \* $P` + echo $ep +} + function func_sed_params(){ filename=$1 line=$2 @@ -83,9 +95,8 @@ line_num=`expr $line_num + 1` fp_items=$(func_parser_value "${lines[line_num]}") line_num=`expr $line_num + 1` epoch=$(func_parser_value "${lines[line_num]}") -eval "sed -i '10i\ repeat: ${epoch}' configs/datasets/coco_detection.yml" -eval "sed -i '10i\ repeat: ${epoch}' configs/datasets/coco_instance.yml" -eval "sed -i '10i\ repeat: ${epoch}' configs/datasets/mot.yml" +line_num=`expr $line_num + 1` +repeat=$(func_parser_value "${lines[line_num]}") line_num=`expr $line_num + 1` profile_option_key=$(func_parser_key "${lines[line_num]}") @@ -130,7 +141,8 @@ if [ ! -n "$PARAMS" ] ;then IFS="|" batch_size_list=(${batch_size}) fp_items_list=(${fp_items}) - device_num_list=(N1C4) + device_num="N1C4" + device_num_list=($device_num) run_mode="DP" else # parser params from input: modeltype_bs${bs_item}_${fp_item}_${run_mode}_${device_num} @@ -153,6 +165,16 @@ else device_num_list=($device_num) fi +if [[ ${model_name} =~ "higherhrnet" ]] || [[ ${model_name} =~ "hrnet" ]] || [[ ${model_name} =~ "tinypose" ]];then + epoch=$(set_dynamic_epoch $device_num $epoch) +else + epoch=1 + repeat=$(set_dynamic_epoch $device_num $repeat) + eval "sed -i '10c\ repeat: ${repeat}' configs/datasets/coco_detection.yml" + eval "sed -i '10c\ repeat: ${repeat}' configs/datasets/coco_instance.yml" + eval "sed -i '10c\ repeat: ${repeat}' configs/datasets/mot.yml" +fi + IFS="|" for batch_size in ${batch_size_list[*]}; do for precision in ${fp_items_list[*]}; do @@ -160,7 +182,7 @@ for batch_size in ${batch_size_list[*]}; do # sed batchsize and precision func_sed_params "$FILENAME" "${line_precision}" "$precision" func_sed_params "$FILENAME" "${line_batchsize}" "$MODE=$batch_size" - func_sed_params "$FILENAME" "${line_epoch}" "$MODE=1" + func_sed_params "$FILENAME" "${line_epoch}" "$MODE=$epoch" gpu_id=$(set_gpu_id $device_num) if [ ${#gpu_id} -le 1 ];then diff --git a/test_tipc/configs/deformable_detr/deformable_detr_r50_1x_coco_train_infer_python.txt b/test_tipc/configs/deformable_detr/deformable_detr_r50_1x_coco_train_infer_python.txt index 3bdfd193a..b6a238460 100644 --- a/test_tipc/configs/deformable_detr/deformable_detr_r50_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/deformable_detr/deformable_detr_r50_1x_coco_train_infer_python.txt @@ -53,5 +53,6 @@ inference:./deploy/python/infer.py batch_size:2 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco_train_infer_python.txt b/test_tipc/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco_train_infer_python.txt index 360498e74..7bfad1c68 100644 --- a/test_tipc/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco_train_infer_python.txt @@ -53,6 +53,7 @@ inference:./deploy/python/infer.py batch_size:2|8 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/fcos/fcos_r50_fpn_1x_coco_train_infer_python.txt b/test_tipc/configs/fcos/fcos_r50_fpn_1x_coco_train_infer_python.txt index 4c4bb5cfe..136d1c30e 100644 --- a/test_tipc/configs/fcos/fcos_r50_fpn_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/fcos/fcos_r50_fpn_1x_coco_train_infer_python.txt @@ -53,6 +53,7 @@ inference:./deploy/python/infer.py batch_size:2|8 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/gfl/gfl_r50_fpn_1x_coco_train_infer_python.txt b/test_tipc/configs/gfl/gfl_r50_fpn_1x_coco_train_infer_python.txt index 5f4a0effb..23722615b 100644 --- a/test_tipc/configs/gfl/gfl_r50_fpn_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/gfl/gfl_r50_fpn_1x_coco_train_infer_python.txt @@ -53,5 +53,6 @@ inference:./deploy/python/infer.py batch_size:2|8 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/keypoint/higherhrnet_hrnet_w32_512_train_infer_python.txt b/test_tipc/configs/keypoint/higherhrnet_hrnet_w32_512_train_infer_python.txt index 4c5161046..b827e92eb 100644 --- a/test_tipc/configs/keypoint/higherhrnet_hrnet_w32_512_train_infer_python.txt +++ b/test_tipc/configs/keypoint/higherhrnet_hrnet_w32_512_train_infer_python.txt @@ -53,6 +53,7 @@ inference:./deploy/python/keypoint_infer.py batch_size:20|24 fp_items:fp32|fp16 epoch:20 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/keypoint/hrnet_w32_256x192_train_infer_python.txt b/test_tipc/configs/keypoint/hrnet_w32_256x192_train_infer_python.txt index 895a42f78..036c542a9 100644 --- a/test_tipc/configs/keypoint/hrnet_w32_256x192_train_infer_python.txt +++ b/test_tipc/configs/keypoint/hrnet_w32_256x192_train_infer_python.txt @@ -53,6 +53,7 @@ null:null batch_size:64|160 fp_items:fp32|fp16 epoch:40 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/keypoint/tinypose_128x96_train_infer_python.txt b/test_tipc/configs/keypoint/tinypose_128x96_train_infer_python.txt index 2ab30ea78..738a34885 100644 --- a/test_tipc/configs/keypoint/tinypose_128x96_train_infer_python.txt +++ b/test_tipc/configs/keypoint/tinypose_128x96_train_infer_python.txt @@ -54,6 +54,7 @@ random_infer_input:[{float32,[3,128,96]}] ===========================train_benchmark_params========================== batch_size:512 fp_items:fp32|fp16 -epoch:1 +epoch:25 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/mask_rcnn/mask_rcnn_r50_1x_coco_train_infer_python.txt b/test_tipc/configs/mask_rcnn/mask_rcnn_r50_1x_coco_train_infer_python.txt index d82e0db2a..0437aa929 100644 --- a/test_tipc/configs/mask_rcnn/mask_rcnn_r50_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/mask_rcnn/mask_rcnn_r50_1x_coco_train_infer_python.txt @@ -49,11 +49,5 @@ inference:./deploy/python/infer.py --save_log_path:null --run_benchmark:False --trt_max_shape:1600 -===========================train_benchmark_params========================== -batch_size:2|4 -fp_items:fp32|fp16 -epoch:1 ---profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile -flags:null ===========================infer_benchmark_params=========================== numpy_infer_input:3x800x1344.npy \ No newline at end of file diff --git a/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_train_infer_python.txt b/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_train_infer_python.txt index 6071bdec3..f03b573c0 100644 --- a/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_train_infer_python.txt @@ -53,6 +53,7 @@ inference:./deploy/python/infer.py batch_size:2|4 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/mot/fairmot_dla34_30e_1088x608_train_infer_python.txt b/test_tipc/configs/mot/fairmot_dla34_30e_1088x608_train_infer_python.txt index 650878eba..0cf5b61b8 100644 --- a/test_tipc/configs/mot/fairmot_dla34_30e_1088x608_train_infer_python.txt +++ b/test_tipc/configs/mot/fairmot_dla34_30e_1088x608_train_infer_python.txt @@ -52,7 +52,8 @@ inference:./deploy/pptracking/python/mot_jde_infer.py ===========================train_benchmark_params========================== batch_size:6|22 fp_items:fp32|fp16 -epoch:2 +epoch:1 +repeat:2 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/mot/jde_darknet53_30e_1088x608_train_infer_python.txt b/test_tipc/configs/mot/jde_darknet53_30e_1088x608_train_infer_python.txt index f9e024b0f..e5760fbea 100644 --- a/test_tipc/configs/mot/jde_darknet53_30e_1088x608_train_infer_python.txt +++ b/test_tipc/configs/mot/jde_darknet53_30e_1088x608_train_infer_python.txt @@ -53,6 +53,7 @@ inference:./deploy/pptracking/python/mot_jde_infer.py batch_size:4|14 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/picodet/picodet_lcnet_1_5x_416_coco_train_infer_python.txt b/test_tipc/configs/picodet/picodet_lcnet_1_5x_416_coco_train_infer_python.txt index d59ca2a39..b5b0676d4 100644 --- a/test_tipc/configs/picodet/picodet_lcnet_1_5x_416_coco_train_infer_python.txt +++ b/test_tipc/configs/picodet/picodet_lcnet_1_5x_416_coco_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x416x416_2.npy batch_size:80 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/picodet/picodet_s_320_coco_lcnet_train_infer_python.txt b/test_tipc/configs/picodet/picodet_s_320_coco_lcnet_train_infer_python.txt index e603169a2..12874c646 100644 --- a/test_tipc/configs/picodet/picodet_s_320_coco_lcnet_train_infer_python.txt +++ b/test_tipc/configs/picodet/picodet_s_320_coco_lcnet_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x320x320_2.npy batch_size:128 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/picodet/picodet_s_320_coco_train_infer_python.txt b/test_tipc/configs/picodet/picodet_s_320_coco_train_infer_python.txt index 6745bcc52..d04567e1e 100644 --- a/test_tipc/configs/picodet/picodet_s_320_coco_train_infer_python.txt +++ b/test_tipc/configs/picodet/picodet_s_320_coco_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x320x320_2.npy batch_size:128 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/ppyolo/ppyolo_mbv3_large_coco_train_infer_python.txt b/test_tipc/configs/ppyolo/ppyolo_mbv3_large_coco_train_infer_python.txt index 801a2eaf2..1735bfe5a 100644 --- a/test_tipc/configs/ppyolo/ppyolo_mbv3_large_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyolo/ppyolo_mbv3_large_coco_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x320x320.npy batch_size:24 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco_train_infer_python.txt b/test_tipc/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco_train_infer_python.txt index 331f649a8..8ab40462d 100644 --- a/test_tipc/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x608x608.npy batch_size:24 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/ppyolo/ppyolo_tiny_650e_coco_train_infer_python.txt b/test_tipc/configs/ppyolo/ppyolo_tiny_650e_coco_train_infer_python.txt index 3201bcd43..2fed9d1ba 100644 --- a/test_tipc/configs/ppyolo/ppyolo_tiny_650e_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyolo/ppyolo_tiny_650e_coco_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x320x320.npy batch_size:32 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco_train_infer_python.txt b/test_tipc/configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco_train_infer_python.txt index d767a3631..af0bb920f 100644 --- a/test_tipc/configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x640x640.npy batch_size:12 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_infer_python.txt b/test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_infer_python.txt index 459f6e02c..536d969b3 100644 --- a/test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x640x640.npy batch_size:32 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/solov2/solov2_r50_fpn_1x_coco_train_infer_python.txt b/test_tipc/configs/solov2/solov2_r50_fpn_1x_coco_train_infer_python.txt index 41282abc8..4cc4de189 100644 --- a/test_tipc/configs/solov2/solov2_r50_fpn_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/solov2/solov2_r50_fpn_1x_coco_train_infer_python.txt @@ -53,6 +53,7 @@ inference:./deploy/python/infer.py batch_size:2|4 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt b/test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt index 472b2af56..43e8e643c 100644 --- a/test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt +++ b/test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt @@ -53,6 +53,7 @@ null:null batch_size:8 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/prepare.sh b/test_tipc/prepare.sh index c8259ae30..252b59aa2 100644 --- a/test_tipc/prepare.sh +++ b/test_tipc/prepare.sh @@ -83,7 +83,8 @@ elif [ ${MODE} = "cpp_infer" ];then fi cd ../../ elif [ ${MODE} = "benchmark_train" ];then - pip install -U pip Cython + pip install -U pip + pip install Cython pip install -r requirements.txt # prepare lite benchmark coco data wget -nc -P ./dataset/coco/ https://paddledet.bj.bcebos.com/data/coco_benchmark.tar --no-check-certificate diff --git a/test_tipc/test_train_inference_python.sh b/test_tipc/test_train_inference_python.sh index dba6b8de3..d92ef2c3e 100644 --- a/test_tipc/test_train_inference_python.sh +++ b/test_tipc/test_train_inference_python.sh @@ -262,11 +262,6 @@ else continue fi - if [ ${autocast} = "amp" ] || [ ${autocast} = "fp16" ]; then - set_autocast="--amp" - else - set_autocast=" " - fi set_epoch=$(func_set_params "${epoch_key}" "${epoch_num}") set_pretrain=$(func_set_params "${pretrain_model_key}" "${pretrain_model_value}") set_batchsize=$(func_set_params "${train_batch_key}" "${train_batch_value}") @@ -274,6 +269,12 @@ else set_use_gpu=$(func_set_params "${train_use_gpu_key}" "${use_gpu}") set_train_params1=$(func_set_params "${train_param_key1}" "${train_param_value1}") save_log="${LOG_PATH}/${trainer}_gpus_${gpu}_autocast_${autocast}" + if [ ${autocast} = "amp" ] || [ ${autocast} = "fp16" ]; then + set_autocast="--amp" + set_train_params1="amp_level=O2" + else + set_autocast=" " + fi set_save_model=$(func_set_params "${save_model_key}" "${save_log}") nodes="1" -- GitLab