Skip to content

Commit cd825bd

Browse files
authored
fix: Fix L0_nullchar_string test (#8120)
1 parent 1f6aed2 commit cd825bd

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

qa/L0_nullchar_string/nullchar_string_client.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
2+
# Copyright (c) 2019-2025, 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
@@ -89,9 +89,17 @@
8989

9090
# Send inference request to the inference server. Get results for
9191
# output tensor.
92+
input_name = "INPUT0"
93+
output_name = "OUTPUT0"
94+
95+
# If using libtorch model, set input and output name to "INPUT__0" and "OUTPUT__0"
96+
if "libtorch" in FLAGS.model_name:
97+
input_name = "INPUT__0"
98+
output_name = "OUTPUT__0"
99+
92100
inputs = [
93101
client_util.InferInput(
94-
"INPUT0", input0_data.shape, np_to_triton_dtype(np.object_)
102+
input_name, input0_data.shape, np_to_triton_dtype(np.object_)
95103
)
96104
]
97105
inputs[0].set_data_from_numpy(input0_data)
@@ -100,7 +108,7 @@
100108

101109
# We expect there to be 1 result (with batch-size 1). Compare the input
102110
# and output tensor calculated by the model. They must be the same.
103-
output0_data = results.as_numpy("OUTPUT0")
111+
output0_data = results.as_numpy(output_name)
104112

105113
print(input0_data, "?=?", output0_data)
106114
assert np.equal(input0_data.astype(np.bytes_), output0_data).all()

qa/L0_nullchar_string/test.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export CUDA_VISIBLE_DEVICES=0
4242

4343
CLIENT_LOG="./client.log"
4444
DATADIR=/data/inferenceserver/${REPO_VERSION}/qa_identity_model_repository
45-
MODELS="onnx_nobatch_zero_1_object libtorch_nobatch_zero_1_object"
45+
MODELS="python_string libtorch_nobatch_zero_1_object"
4646
NULLCHAR_CLIENT_PY=nullchar_string_client.py
4747

4848
SERVER=/opt/tritonserver/bin/tritonserver
@@ -53,9 +53,15 @@ source ../common/util.sh
5353
rm -f $CLIENT_LOG $SERVER_LOG models
5454

5555
mkdir -p models
56-
for MODEL in $MODELS; do
57-
cp -r $DATADIR/$MODEL models/.
58-
done
56+
57+
# Copy the python model
58+
mkdir -p models/python_string/1/
59+
cp -fr ../python_models/string/model.py models/python_string/1/
60+
cp ../python_models/string/config.pbtxt models/python_string
61+
sed -i 's/name: "string"/name: "python_string"/' models/python_string/config.pbtxt
62+
63+
# Copy the libtorch model
64+
cp -r $DATADIR/libtorch_nobatch_zero_1_object models/.
5965

6066
run_server
6167
if [ "$SERVER_PID" == "0" ]; then

0 commit comments

Comments
 (0)