add dynamic int and fp16 mix precision door

This commit is contained in:
duzhixing 2023-01-03 19:18:53 +08:00
parent 64134d8db7
commit aa19fd0510
2 changed files with 15 additions and 5 deletions

View File

@ -0,0 +1,6 @@
PC500_model_mobilevit_s.onnx 9 12070528
PC500_model_mobilevit_xxs.onnx 8 2881832
PC500_model_efficientformer_l1.onnx 15 38329872
HDC_multimedia_3M_vit32_60ep_clip_vit_base_text.mindir 17 51428112
HDC_multimedia_3M_vit32_60ep_clip_vit_base_image.mindir 16 90264280

View File

@ -14,11 +14,14 @@ function Run_Converter() {
rm -rf ${ms_models_path}
mkdir -p ${ms_models_path}
# Convert models:
if [[ $1 == "arm64_fp16" ]]; then
if [[ $1 != "arm64_fp16" ]]; then
# $1:cfgFileList; $2:inModelPath; $3:outModelPath; $4:logFile; $5:resultFile;
Convert "${fp32_cfg_file_list[*]}" $models_path $ms_models_path $run_converter_log_file $run_converter_result_file $arm64_fail_not_return
fi
if [[ $1 == "arm64_fp16" || $1 == "arm64_quant" ]]; then
# $1:cfgFileList; $2:inModelPath; $3:outModelPath; $4:logFile; $5:resultFile;
Convert "${fp16_cfg_file_list[*]}" $models_path $ms_models_path $run_converter_log_file $run_converter_result_file $arm64_fail_not_return
else
Convert "${fp32_cfg_file_list[*]}" $models_path $ms_models_path $run_converter_log_file $run_converter_result_file $arm64_fail_not_return
fi
}
@ -113,6 +116,7 @@ models_weightquant_7bit_config=${basepath}/../${config_folder}/models_weightquan
models_weightquant_9bit_config=${basepath}/../${config_folder}/models_weightquant_9bit.cfg
models_weightquant_8bit_config=${basepath}/../${config_folder}/models_weightquant_8bit.cfg
models_dynamic_quant_config=${basepath}/../${config_folder}/models_dynamic_quant.cfg
models_dynamic_quant_fp16_config=${basepath}/../${config_folder}/models_dynamic_quant_fp16.cfg
models_compatibility_config=${basepath}/../${config_folder}/models_compatibility.cfg
models_process_only_config=${basepath}/../${config_folder}/models_process_only.cfg
models_process_only_fp16_config=${basepath}/../${config_folder}/models_process_only_fp16.cfg
@ -139,14 +143,14 @@ elif [[ $backend == "arm64_mindir" ]]; then
elif [[ $backend == "arm64_quant" ]]; then
fp32_cfg_file_list=("$models_posttraining_config" "$models_process_only_config" "$models_weightquant_8bit_config" \
"$models_weightquant_7bit_config" "$models_weightquant_9bit_config" "$models_dynamic_quant_config")
fp16_cfg_file_list=("$models_process_only_fp16_config")
fp16_cfg_file_list=("$models_process_only_fp16_config" "$models_dynamic_quant_fp16_config")
else
fp32_cfg_file_list=("$models_tf_config" "$models_tflite_config" "$models_caffe_config" "$models_onnx_config" "$models_mindspore_config" \
"$models_posttraining_config" "$models_process_only_config" "$models_tflite_awaretraining_config" \
"$models_weightquant_8bit_config" "$models_weightquant_7bit_config" \
"$models_weightquant_9bit_config" "$models_dynamic_quant_config")
fp16_cfg_file_list=("$models_onnx_fp16_config" "$models_caffe_fp16_config" "$models_tflite_fp16_config" "$models_tf_fp16_config" \
"$models_process_only_fp16_config" "$models_mindspore_fp16_config")
"$models_process_only_fp16_config" "$models_mindspore_fp16_config" "$models_dynamic_quant_fp16_config")
fi
ms_models_path=${basepath}/ms_models