Skip to content

Commit 9082a24

Browse files
authored
test: Special handling for ONNX bf16 models in tests (#8800)
1 parent e24fd86 commit 9082a24

3 files changed

Lines changed: 33 additions & 17 deletions

File tree

qa/L0_http_fuzz/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright (c) 2020-2025, NVIDIA CORPORATION. All rights reserved.
2+
# Copyright (c) 2020-2026, NVIDIA CORPORATION. All rights reserved.
33
#
44
# Redistribution and use in source and binary forms, with or without
55
# modification, are permitted provided that the following conditions
@@ -65,7 +65,7 @@ function_install_python38() {
6565

6666
# Install test script dependencies
6767
pip3 install --upgrade wheel setuptools boofuzz==0.3.0 "numpy<2" pillow attrdict future grpcio requests gsutil \
68-
awscli six grpcio-channelz prettytable virtualenv
68+
awscli six grpcio-channelz prettytable virtualenv ml_dtypes
6969
}
7070
function_install_python38
7171

qa/L0_infer/test.sh

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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

qa/L0_infer_variable/test.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright (c) 2019-2025, NVIDIA CORPORATION. All rights reserved.
2+
# Copyright (c) 2019-2026, NVIDIA CORPORATION. All rights reserved.
33
#
44
# Redistribution and use in source and binary forms, with or without
55
# modification, are permitted provided that the following conditions
@@ -64,6 +64,11 @@ for TARGET in cpu gpu; do
6464
cp -r /data/inferenceserver/${REPO_VERSION}/qa_variable_model_repository models && \
6565
cp -r /data/inferenceserver/${REPO_VERSION}/qa_ensemble_model_repository/qa_variable_model_repository/* models/.
6666

67+
# Remove ONNX BF16 models from CPU models
68+
if [ "$TARGET" == "cpu" ]; then
69+
rm -rf models/onnx_*bf16*
70+
fi
71+
6772
create_nop_version_dir `pwd`/models
6873

6974
KIND="KIND_GPU" && [[ "$TARGET" == "cpu" ]] && KIND="KIND_CPU"

0 commit comments

Comments
 (0)