File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
- # Copyright (c) 2019-2020 , NVIDIA CORPORATION. All rights reserved.
2
+ # Copyright (c) 2019-2025 , NVIDIA CORPORATION. All rights reserved.
3
3
#
4
4
# Redistribution and use in source and binary forms, with or without
5
5
# modification, are permitted provided that the following conditions
89
89
90
90
# Send inference request to the inference server. Get results for
91
91
# 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
+
92
100
inputs = [
93
101
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_ )
95
103
)
96
104
]
97
105
inputs [0 ].set_data_from_numpy (input0_data )
100
108
101
109
# We expect there to be 1 result (with batch-size 1). Compare the input
102
110
# 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 )
104
112
105
113
print (input0_data , "?=?" , output0_data )
106
114
assert np .equal (input0_data .astype (np .bytes_ ), output0_data ).all ()
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ export CUDA_VISIBLE_DEVICES=0
42
42
43
43
CLIENT_LOG=" ./client.log"
44
44
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"
46
46
NULLCHAR_CLIENT_PY=nullchar_string_client.py
47
47
48
48
SERVER=/opt/tritonserver/bin/tritonserver
@@ -53,9 +53,15 @@ source ../common/util.sh
53
53
rm -f $CLIENT_LOG $SERVER_LOG models
54
54
55
55
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/.
59
65
60
66
run_server
61
67
if [ " $SERVER_PID " == " 0" ]; then
You can’t perform that action at this time.
0 commit comments