Merge pull request #1551 from mmglove/develop

[tests] fix benchmark
pull/1556/head
Hui Zhang 3 years ago committed by GitHub
commit baec77e160
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -141,7 +141,6 @@ else
batch_size=${params_list[1]} batch_size=${params_list[1]}
batch_size=`echo ${batch_size} | tr -cd "[0-9]" ` batch_size=`echo ${batch_size} | tr -cd "[0-9]" `
precision=${params_list[2]} precision=${params_list[2]}
# run_process_type=${params_list[3]}
run_mode=${params_list[3]} run_mode=${params_list[3]}
device_num=${params_list[4]} device_num=${params_list[4]}
IFS=";" IFS=";"
@ -166,10 +165,9 @@ for batch_size in ${batch_size_list[*]}; do
gpu_id=$(set_gpu_id $device_num) gpu_id=$(set_gpu_id $device_num)
if [ ${#gpu_id} -le 1 ];then if [ ${#gpu_id} -le 1 ];then
run_process_type="SingleP"
log_path="$SAVE_LOG/profiling_log" log_path="$SAVE_LOG/profiling_log"
mkdir -p $log_path mkdir -p $log_path
log_name="${repo_name}_${model_name}_bs${batch_size}_${precision}_${run_process_type}_${run_mode}_${device_num}_profiling" log_name="${repo_name}_${model_name}_bs${batch_size}_${precision}_${run_mode}_${device_num}_profiling"
func_sed_params "$FILENAME" "${line_gpuid}" "0" # sed used gpu_id func_sed_params "$FILENAME" "${line_gpuid}" "0" # sed used gpu_id
# set profile_option params # set profile_option params
tmp=`sed -i "${line_profile}s/.*/${profile_option}/" "${FILENAME}"` tmp=`sed -i "${line_profile}s/.*/${profile_option}/" "${FILENAME}"`
@ -185,8 +183,8 @@ for batch_size in ${batch_size_list[*]}; do
speed_log_path="$SAVE_LOG/index" speed_log_path="$SAVE_LOG/index"
mkdir -p $log_path mkdir -p $log_path
mkdir -p $speed_log_path mkdir -p $speed_log_path
log_name="${repo_name}_${model_name}_bs${batch_size}_${precision}_${run_process_type}_${run_mode}_${device_num}_log" log_name="${repo_name}_${model_name}_bs${batch_size}_${precision}_${run_mode}_${device_num}_log"
speed_log_name="${repo_name}_${model_name}_bs${batch_size}_${precision}_${run_process_type}_${run_mode}_${device_num}_speed" speed_log_name="${repo_name}_${model_name}_bs${batch_size}_${precision}_${run_mode}_${device_num}_speed"
func_sed_params "$FILENAME" "${line_profile}" "null" # sed profile_id as null func_sed_params "$FILENAME" "${line_profile}" "null" # sed profile_id as null
cmd="bash test_tipc/test_train_inference_python.sh ${FILENAME} benchmark_train > ${log_path}/${log_name} 2>&1 " cmd="bash test_tipc/test_train_inference_python.sh ${FILENAME} benchmark_train > ${log_path}/${log_name} 2>&1 "
echo $cmd echo $cmd
@ -197,13 +195,12 @@ for batch_size in ${batch_size_list[*]}; do
eval "cat ${log_path}/${log_name}" eval "cat ${log_path}/${log_name}"
# parser log # parser log
_model_name="${model_name}_bs${batch_size}_${precision}_${run_process_type}_${run_mode}" _model_name="${model_name}_bs${batch_size}_${precision}_${run_mode}"
cmd="${python} ${BENCHMARK_ROOT}/scripts/analysis.py --filename ${log_path}/${log_name} \ cmd="${python} ${BENCHMARK_ROOT}/scripts/analysis.py --filename ${log_path}/${log_name} \
--speed_log_file '${speed_log_path}/${speed_log_name}' \ --speed_log_file '${speed_log_path}/${speed_log_name}' \
--model_name ${_model_name} \ --model_name ${_model_name} \
--base_batch_size ${batch_size} \ --base_batch_size ${batch_size} \
--run_mode ${run_mode} \ --run_mode ${run_mode} \
--run_process_type ${run_process_type} \
--fp_item ${precision} \ --fp_item ${precision} \
--keyword ips: \ --keyword ips: \
--skip_steps 2 \ --skip_steps 2 \
@ -217,13 +214,12 @@ for batch_size in ${batch_size_list[*]}; do
else else
IFS=";" IFS=";"
unset_env=`unset CUDA_VISIBLE_DEVICES` unset_env=`unset CUDA_VISIBLE_DEVICES`
run_process_type="MultiP"
log_path="$SAVE_LOG/train_log" log_path="$SAVE_LOG/train_log"
speed_log_path="$SAVE_LOG/index" speed_log_path="$SAVE_LOG/index"
mkdir -p $log_path mkdir -p $log_path
mkdir -p $speed_log_path mkdir -p $speed_log_path
log_name="${repo_name}_${model_name}_bs${batch_size}_${precision}_${run_process_type}_${run_mode}_${device_num}_log" log_name="${repo_name}_${model_name}_bs${batch_size}_${precision}_${run_mode}_${device_num}_log"
speed_log_name="${repo_name}_${model_name}_bs${batch_size}_${precision}_${run_process_type}_${run_mode}_${device_num}_speed" speed_log_name="${repo_name}_${model_name}_bs${batch_size}_${precision}_${run_mode}_${device_num}_speed"
func_sed_params "$FILENAME" "${line_gpuid}" "$gpu_id" # sed used gpu_id func_sed_params "$FILENAME" "${line_gpuid}" "$gpu_id" # sed used gpu_id
func_sed_params "$FILENAME" "${line_profile}" "null" # sed --profile_option as null func_sed_params "$FILENAME" "${line_profile}" "null" # sed --profile_option as null
cmd="bash test_tipc/test_train_inference_python.sh ${FILENAME} benchmark_train > ${log_path}/${log_name} 2>&1 " cmd="bash test_tipc/test_train_inference_python.sh ${FILENAME} benchmark_train > ${log_path}/${log_name} 2>&1 "
@ -234,14 +230,13 @@ for batch_size in ${batch_size_list[*]}; do
export model_run_time=$((${job_et}-${job_bt})) export model_run_time=$((${job_et}-${job_bt}))
eval "cat ${log_path}/${log_name}" eval "cat ${log_path}/${log_name}"
# parser log # parser log
_model_name="${model_name}_bs${batch_size}_${precision}_${run_process_type}_${run_mode}" _model_name="${model_name}_bs${batch_size}_${precision}_${run_mode}"
cmd="${python} ${BENCHMARK_ROOT}/scripts/analysis.py --filename ${log_path}/${log_name} \ cmd="${python} ${BENCHMARK_ROOT}/scripts/analysis.py --filename ${log_path}/${log_name} \
--speed_log_file '${speed_log_path}/${speed_log_name}' \ --speed_log_file '${speed_log_path}/${speed_log_name}' \
--model_name ${_model_name} \ --model_name ${_model_name} \
--base_batch_size ${batch_size} \ --base_batch_size ${batch_size} \
--run_mode ${run_mode} \ --run_mode ${run_mode} \
--run_process_type ${run_process_type} \
--fp_item ${precision} \ --fp_item ${precision} \
--keyword ips: \ --keyword ips: \
--skip_steps 2 \ --skip_steps 2 \

@ -26,8 +26,10 @@ if [ ${MODE} = "benchmark_train" ];then
curPath=$(readlink -f "$(dirname "$0")") curPath=$(readlink -f "$(dirname "$0")")
echo "curPath:"${curPath} echo "curPath:"${curPath}
cd ${curPath}/../.. cd ${curPath}/../..
apt-get install libsndfile1 apt-get install libsndfile1 -y
pip install pytest-runner kaldiio setuptools_scm -i https://pypi.tuna.tsinghua.edu.cn/simple pip install pytest-runner -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install kaldiio -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install setuptools_scm -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install . -i https://pypi.tuna.tsinghua.edu.cn/simple pip install . -i https://pypi.tuna.tsinghua.edu.cn/simple
cd - cd -
if [ ${model_name} == "conformer" ]; then if [ ${model_name} == "conformer" ]; then

Loading…
Cancel
Save