!31473 [MSLITE] Enable to convert models parallelly.

Merge pull request !31473 from wangshaocong/ci_master
This commit is contained in:
i-robot 2022-03-18 02:28:08 +00:00 committed by Gitee
commit daf2f88a76
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 118 additions and 105 deletions

View File

@ -3,6 +3,13 @@
# Convert models:
function Convert() {
# $1:cfgFileList; $2:inModelPath; $3:outModelPath; $4:logFile; $5:resultFile; $6:failNotReturn;
fifo_file="fifo_file.txt"
mkfifo ${fifo_file}
exec 6<>${fifo_file}
rm -f ${fifo_file}
max_converter_jobs=6
for ((i = 0; i < ${max_converter_jobs}; i++)); do echo; done >&6
local cfg_file_list model_info model_name extra_info model_type cfg_file_name model_file weight_file output_file \
quant_type config_file train_model in_dtype out_dtype converter_result cfg_file calib_size
cfg_file_list=$1
@ -11,6 +18,8 @@ function Convert() {
if [[ $line == \#* || $line == "" ]]; then
continue
fi
read -u6
{
model_info=`echo ${line} | awk -F ' ' '{print $1}'`
calib_size=`echo ${line} | awk -F ' ' '{print $3}'`
model_name=`echo ${model_info} | awk -F ';' '{print $1}'`
@ -120,8 +129,12 @@ function Convert() {
return 1
fi
fi
echo >&6
} &
done < ${cfg_file}
done
wait
exec 6>&-
}
function Push_Files() {