Skip to content

Commit e5f5faf

Browse files
authored
feat: Enable PyTorch2 Batching Tests (#8814) (#8831)
1 parent d898a0f commit e5f5faf

5 files changed

Lines changed: 875 additions & 66 deletions

File tree

qa/L0_torch_aoti/test.sh

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ DATADIR=${DATADIR:="/data/inferenceserver/${REPO_VERSION}"}
6262
TRITON_DIR=${TRITON_DIR:="/opt/tritonserver"}
6363
SERVER=${TRITON_DIR}/bin/tritonserver
6464
BACKEND_DIR=${TRITON_DIR}/backends
65+
SERVER_TIMEOUT=${SERVER_TIMEOUT:=120}
6566

6667
# PyTorch on SBSA requires libgomp to be loaded first. See the following
6768
# GitHub issue for more information:
@@ -79,7 +80,9 @@ export BACKENDS
7980

8081
# Copy the models into the model repository
8182
echo -e "${COLOR_DARK}Setting up model repository in ${MODELDIR}${COLOR_RESET}"
82-
rm -rf ${MODELDIR} && mkdir -p ${MODELDIR}
83+
BAD_MODELDIR=`pwd`/bad_models
84+
rm -rf ${MODELDIR} ${BAD_MODELDIR}
85+
mkdir -p ${MODELDIR}
8386
models=(
8487
"torch_aoti_complex_index"
8588
"torch_aoti_complex_named"
@@ -89,13 +92,28 @@ models=(
8992
"torch_aoti_int64_int64"
9093
"torch_aoti_float16_float16"
9194
"torch_aoti_float32_float32"
95+
"torch_aoti_variable_float32"
96+
"torch_aoti_multi_instance_float32"
9297
"torchvision_aoti"
9398
)
9499
for model in "${models[@]}"; do
95100
cp -r ${DATADIR}/qa_model_repository/${model} ${MODELDIR}/${model}
96101
echo -e "${COLOR_DARK}ls ${MODELDIR}/${model}${COLOR_RESET}"
97102
ls -lha ${MODELDIR}/${model}
98103
done
104+
105+
# Sequence-batching AOTI models live in the implicit-state sequence repository.
106+
sequence_models=(
107+
"torch_aoti_sequence_float32"
108+
"torch_aoti_sequence_initstate_float32"
109+
"torch_aoti_sequence_forward_float32"
110+
)
111+
for model in "${sequence_models[@]}"; do
112+
cp -r ${DATADIR}/qa_sequence_implicit_model_repository/${model} ${MODELDIR}/${model}
113+
echo -e "${COLOR_DARK}ls ${MODELDIR}/${model}${COLOR_RESET}"
114+
ls -lha ${MODELDIR}/${model}
115+
done
116+
99117
echo -e "${COLOR_DARK}ls ${MODELDIR}${COLOR_RESET}"
100118
ls -lha ${MODELDIR}
101119

@@ -133,11 +151,42 @@ fi
133151
echo -e "${COLOR_DARK}Killing server (pid: ${SERVER_PID})${COLOR_RESET}"
134152
kill -s SIGINT ${SERVER_PID}
135153
wait ${SERVER_PID} || true
136-
echo -e "${COLOR_DARK}Removing model repository${COLOR_RESET}"
137-
for model in "${models[@]}"; do
138-
rm -rf ${MODELDIR}/${model}
154+
155+
# Negative tests: these models declare unsupported types (TYPE_STRING CORRID /
156+
# state) and must fail to load. Start a separate server (exit-on-error=false) so
157+
# it stays up despite the load failures, then assert the models are not ready.
158+
echo -e "${COLOR_DARK}Negative (load-failure) tests${COLOR_RESET}"
159+
mkdir -p ${BAD_MODELDIR}
160+
bad_models=(
161+
"torch_aoti_sequence_bad_corrid"
162+
"torch_aoti_sequence_bad_state"
163+
)
164+
for model in "${bad_models[@]}"; do
165+
cp -r ${DATADIR}/qa_sequence_implicit_model_repository/${model} ${BAD_MODELDIR}/${model}
139166
done
140167

168+
SERVER_ARGS="--model-repository=${BAD_MODELDIR} --exit-on-error=false --log-verbose=1"
169+
SERVER_LOG="./torch_aoti_negative-server.log"
170+
run_server_tolive
171+
if [[ "${SERVER_PID}" -eq 0 ]]; then
172+
echo -e "${COLOR_ERROR}\n***\n*** Failed to start ${SERVER} (negative phase)\n***${COLOR_RESET}" 1>&2
173+
cat ${SERVER_LOG} 1>&2
174+
RET=1
175+
else
176+
wait_for_model_stable ${SERVER_TIMEOUT}
177+
for model in "${bad_models[@]}"; do
178+
code=$(curl -s -o /dev/null -w "%{http_code}" localhost:8000/v2/models/${model}/ready)
179+
if [[ "${code}" == "200" ]]; then
180+
echo -e "${COLOR_ERROR}*** Negative model '${model}' unexpectedly loaded (ready)${COLOR_RESET}" 1>&2
181+
RET=1
182+
else
183+
echo -e "${COLOR_INFO}*** Negative model '${model}' correctly failed to load${COLOR_RESET}"
184+
fi
185+
done
186+
kill -s SIGINT ${SERVER_PID}
187+
wait ${SERVER_PID} || true
188+
fi
189+
141190
# Report results and exit.
142191
if [[ ${RET} -ne 0 ]]; then
143192
echo -e "${COLOR_ERROR}\n***\n*** Test Suite FAILED\n***${COLOR_RESET}" &1>2

0 commit comments

Comments
 (0)