@@ -163,6 +163,9 @@ function generate_model_repository() {
163163 # Types that need to use SubAdd instead of AddSub
164164 swap_types=" float32 int32 int16 int8"
165165 for onnx_model in $onnx_models ; do
166+ # Skip BF16 models: Not yet supported by Python backend
167+ [[ " $onnx_model " == * bf16* ]] && continue
168+
166169 if [ " $BACKEND " == " python_dlpack" ]; then
167170 python_model=` echo $onnx_model | sed ' s/onnx/python_dlpack/g' | sed ' s,' " $DATADIR /qa_model_repository/" ' ,,g' `
168171 else
@@ -215,6 +218,10 @@ function generate_model_repository() {
215218 else
216219 cp -r ${DATADIR} /qa_model_repository/${BACKEND} * \
217220 models/.
221+ # Remove ONNX BF16 models from CPU models
222+ if [ " $BACKEND " == " onnx" ] && [ " $TARGET " == " cpu" ]; then
223+ rm -rf models/onnx_* bf16*
224+ fi
218225 fi
219226 done
220227
@@ -253,20 +260,24 @@ function generate_model_repository() {
253260
254261 KIND=" KIND_GPU" && [[ " $TARGET " == " cpu" ]] && KIND=" KIND_CPU"
255262 for FW in $BACKENDS ; do
256- if [ " $FW " == " onnx" ] && [ " $TEST_VALGRIND " -eq 1 ]; then
257- # Reduce the instance count to make loading onnx models faster
258- for MC in ` ls models/${FW} * /config.pbtxt` ; do
259- echo " instance_group [ { kind: ${KIND} count: 1 }]" >> $MC
260- done
261- elif [ " $FW " != " plan" ] && [ " $FW " != " python" ] && [ " $FW " != " python_dlpack" ] && [ " $FW " != " openvino" ]; then
262- for MC in ` ls models/${FW} * /config.pbtxt` ; do
263- echo " instance_group [ { kind: ${KIND} }]" >> $MC
264- done
265- elif [ " $FW " == " python" ] || [ " $FW " == " python_dlpack" ] || [ " $FW " == " openvino" ]; then
266- for MC in ` ls models/${FW} * /config.pbtxt` ; do
267- echo " instance_group [ { kind: KIND_CPU }]" >> $MC
268- done
269- fi
263+ [ " $FW " == " plan" ] && continue
264+ for MC in ` ls models/${FW} * /config.pbtxt` ; do
265+ # BF16 models: ORT CPU has no BF16 kernels, force GPU
266+ if [ " $FW " == " onnx" ] && [ " $MC " == * bf16* ]; then
267+ MC_KIND=" KIND_GPU"
268+ else
269+ MC_KIND=${KIND}
270+ fi
271+
272+ if [ " $FW " == " onnx" ] && [ " $TEST_VALGRIND " -eq 1 ]; then
273+ # Reduce the instance count to make loading onnx models faster
274+ echo " instance_group [ { kind: ${MC_KIND} count: 1 }]" >> $MC
275+ elif [ " $FW " == " python" ] || [ " $FW " == " python_dlpack" ] || [ " $FW " == " openvino" ]; then
276+ echo " instance_group [ { kind: KIND_CPU }]" >> $MC
277+ else
278+ echo " instance_group [ { kind: ${KIND} }]" >> $MC
279+ fi
280+ done
270281 done
271282
272283 # Modify custom_zero_1_float32 and custom_nobatch_zero_1_float32 for relevant ensembles
0 commit comments