From e47f4350c2a905c02bc41e17cdff43d34145cf44 Mon Sep 17 00:00:00 2001 From: Tingquan Gao <35441050@qq.com> Date: Wed, 5 Jul 2023 20:03:59 +0800 Subject: [PATCH] support ampo1 in benchmark; fp16 -> amp (#8412) * support ampo1 in benchmark; fp16 -> amp * benchmark: fp16 -> amp --- .../dino/dino_r50_4scale_1x_coco_train_infer_python.txt | 4 ++-- .../picodet_lcnet_2_5x_416_coco_train_infer_python.txt | 4 ++-- .../picodet_s_320_coco_lcnet_train_infer_python.txt | 4 ++-- .../ppyoloe_plus_crn_l_80e_coco_train_infer_python.txt | 2 +- .../rtdetr/rtdetr_hgnetv2_l_6x_coco_train_infer_python.txt | 4 ++-- test_tipc/test_train_inference_python.sh | 7 +++++-- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/test_tipc/configs/dino/dino_r50_4scale_1x_coco_train_infer_python.txt b/test_tipc/configs/dino/dino_r50_4scale_1x_coco_train_infer_python.txt index 475397867..0caed66de 100644 --- a/test_tipc/configs/dino/dino_r50_4scale_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/dino/dino_r50_4scale_1x_coco_train_infer_python.txt @@ -51,10 +51,10 @@ inference:./deploy/python/infer.py --trt_max_shape:1600 ===========================train_benchmark_params========================== batch_size:2 -fp_items:fp32|fp16 +fp_items:fp32|amp epoch:1 repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== -numpy_infer_input:3x640x640_2.npy \ No newline at end of file +numpy_infer_input:3x640x640_2.npy diff --git a/test_tipc/configs/picodet/picodet_lcnet_2_5x_416_coco_train_infer_python.txt b/test_tipc/configs/picodet/picodet_lcnet_2_5x_416_coco_train_infer_python.txt index eeb2cf25f..d1991b085 100644 --- a/test_tipc/configs/picodet/picodet_lcnet_2_5x_416_coco_train_infer_python.txt +++ b/test_tipc/configs/picodet/picodet_lcnet_2_5x_416_coco_train_infer_python.txt @@ -51,10 +51,10 @@ inference:./deploy/python/infer.py null:null ===========================train_benchmark_params========================== batch_size:48 -fp_items:fp32|fp16 +fp_items:fp32|amp epoch:1 repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== -numpy_infer_input:3x416x416_2.npy \ No newline at end of file +numpy_infer_input:3x416x416_2.npy 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 cb10d21b3..ddbf6f64f 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 @@ -51,7 +51,7 @@ inference:./deploy/python/infer.py null:null ===========================train_benchmark_params========================== batch_size:64 -fp_items:fp32|fp16 +fp_items:fp32|amp epoch:1 repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile @@ -59,4 +59,4 @@ flags:null ===========================infer_benchmark_params=========================== numpy_infer_input:3x320x320_2.npy ===========================to_static_train_benchmark_params=========================== -to_static_train:--to_static \ No newline at end of file +to_static_train:--to_static diff --git a/test_tipc/configs/ppyoloe/ppyoloe+/ppyoloe_plus_crn_l_80e_coco_train_infer_python.txt b/test_tipc/configs/ppyoloe/ppyoloe+/ppyoloe_plus_crn_l_80e_coco_train_infer_python.txt index 2f8c4558b..74db86ba9 100644 --- a/test_tipc/configs/ppyoloe/ppyoloe+/ppyoloe_plus_crn_l_80e_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyoloe/ppyoloe+/ppyoloe_plus_crn_l_80e_coco_train_infer_python.txt @@ -51,7 +51,7 @@ inference:./deploy/python/infer.py --trt_max_shape:1600 ===========================train_benchmark_params========================== batch_size:16 -fp_items:fp32|fp16 +fp_items:fp32|amp epoch:1 repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile diff --git a/test_tipc/configs/rtdetr/rtdetr_hgnetv2_l_6x_coco_train_infer_python.txt b/test_tipc/configs/rtdetr/rtdetr_hgnetv2_l_6x_coco_train_infer_python.txt index db9dafd71..5f26996a6 100644 --- a/test_tipc/configs/rtdetr/rtdetr_hgnetv2_l_6x_coco_train_infer_python.txt +++ b/test_tipc/configs/rtdetr/rtdetr_hgnetv2_l_6x_coco_train_infer_python.txt @@ -51,8 +51,8 @@ inference:./deploy/python/infer.py --trt_max_shape:1600 ===========================train_benchmark_params========================== batch_size:16 -fp_items:fp32|fp16 +fp_items:fp32|amp 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 +flags:null diff --git a/test_tipc/test_train_inference_python.sh b/test_tipc/test_train_inference_python.sh index 072fb89cf..d68b58c85 100644 --- a/test_tipc/test_train_inference_python.sh +++ b/test_tipc/test_train_inference_python.sh @@ -203,7 +203,7 @@ if [ ${MODE} = "whole_infer" ] || [ ${MODE} = "klquant_whole_infer" ]; then export_cmd="${python} ${run_export} ${set_export_weight} ${set_filename} ${set_save_export_dir} " echo $export_cmd eval $export_cmd - status_check $? "${export_cmd}" "${status_log}" "${model_name}" + status_check $? "${export_cmd}" "${status_log}" "${model_name}" #run inference save_export_model_dir="${save_export_value}/${model_name}" @@ -279,7 +279,10 @@ 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 + if [ ${autocast} = "amp" ]; then + set_autocast="--amp" + set_amp_level="amp_level=O1" + elif [ ${autocast} = "fp16" ]; then set_autocast="--amp" set_amp_level="amp_level=O2" else -- GitLab