From 1333ab1b97218e6a9cd5fe85ea99a12537e91524 Mon Sep 17 00:00:00 2001 From: WangZhen <23097963+0x45f@users.noreply.github.com> Date: Tue, 22 Nov 2022 14:07:42 +0800 Subject: [PATCH] [TIPC]Polish tipc shell for dy2st (#7381) * Polish tipc shell for dy2st * Add dynamicTostatic check * Fix shell --- test_tipc/benchmark_train.sh | 10 +++++++++- ...v3_darknet53_270e_coco_train_infer_python.txt | 6 ++++-- test_tipc/test_train_inference_python.sh | 16 +++++++++++----- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/test_tipc/benchmark_train.sh b/test_tipc/benchmark_train.sh index f178c4d18..3e41ad9a7 100644 --- a/test_tipc/benchmark_train.sh +++ b/test_tipc/benchmark_train.sh @@ -88,7 +88,7 @@ lines=(${dataline}) model_name=$(func_parser_value "${lines[1]}") # 获取benchmark_params所在的行数 -line_num=`grep -n "train_benchmark_params" $FILENAME | cut -d ":" -f 1` +line_num=`grep -n -w "train_benchmark_params" $FILENAME | cut -d ":" -f 1` # for train log parser batch_size=$(func_parser_value "${lines[line_num]}") line_num=`expr $line_num + 1` @@ -144,6 +144,14 @@ if [ ! -n "$PARAMS" ] ;then device_num="N1C4" device_num_list=($device_num) run_mode="DP" +elif [[ ${PARAMS} = "dynamicTostatic" ]] ;then + IFS="|" + model_type=$PARAMS + batch_size_list=(${batch_size}) + fp_items_list=(${fp_items}) + 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} IFS="_" 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 22c035702..7c0b3aa5b 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 @@ -17,7 +17,7 @@ norm_train:tools/train.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml -o wo pact_train:tools/train.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml --slim_config configs/slim/quant/yolov3_darknet_qat.yml -o fpgm_train:tools/train.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml --slim_config configs/slim/prune/yolov3_darknet_prune_fpgm.yml -o distill_train:null -to_static_train:--to_static +null:null null:null ## ===========================eval_params=========================== @@ -57,4 +57,6 @@ repeat:3 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== -numpy_infer_input:3x608x608.npy \ No newline at end of file +numpy_infer_input:3x608x608.npy +===========================to_static_train_benchmark_params=========================== +to_static_train:--to_static \ No newline at end of file diff --git a/test_tipc/test_train_inference_python.sh b/test_tipc/test_train_inference_python.sh index e56d726ce..d5c09ccf0 100644 --- a/test_tipc/test_train_inference_python.sh +++ b/test_tipc/test_train_inference_python.sh @@ -41,8 +41,8 @@ fpgm_key=$(func_parser_key "${lines[17]}") fpgm_trainer=$(func_parser_value "${lines[17]}") distill_key=$(func_parser_key "${lines[18]}") distill_trainer=$(func_parser_value "${lines[18]}") -to_static_key=$(func_parser_key "${lines[19]}") -to_static_trainer=$(func_parser_value "${lines[19]}") +trainer_key1=$(func_parser_key "${lines[19]}") +trainer_value1=$(func_parser_value "${lines[19]}") trainer_key2=$(func_parser_key "${lines[20]}") trainer_value2=$(func_parser_value "${lines[20]}") @@ -96,6 +96,9 @@ LOG_PATH="./test_tipc/output/${model_name}/${MODE}" mkdir -p ${LOG_PATH} status_log="${LOG_PATH}/results_python.log" +line_num=`grep -n -w "to_static_train_benchmark_params" $FILENAME | cut -d ":" -f 1` +to_static_key=$(func_parser_key "${lines[line_num]}") +to_static_trainer=$(func_parser_value "${lines[line_num]}") function func_inference(){ IFS='|' @@ -251,13 +254,16 @@ else elif [ ${trainer} = "${distill_key}" ]; then run_train=${distill_trainer} run_export=${distill_export} + elif [ ${trainer} = "${trainer_key1}" ]; then + run_train=${trainer_value1} + run_export=${export_value1} + elif [ ${trainer} = "${trainer_key2}" ]; then + run_train=${trainer_value2} + run_export=${export_value2} elif [ ${trainer} = "${to_static_key}" ]; then run_train=${norm_trainer} run_export=${norm_export} set_to_static=${to_static_trainer} - elif [ ${trainer} = "${trainer_key2}" ]; then - run_train=${trainer_value2} - run_export=${export_value2} else continue fi -- GitLab