Skip to content

Commit 6785825

Browse files
committed
update testing layout
1 parent 322782d commit 6785825

3 files changed

Lines changed: 134 additions & 37 deletions

File tree

qa/L0_simple_ensemble/test.sh

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -282,43 +282,8 @@ sed -i 's/time.sleep(delay)/time.sleep(0)/g' \
282282
${MODEL_DIR}/fast_consumer/1/model.py
283283

284284
# Join both parallel branches into the ensemble output.
285-
cp ../python_models/add_sub/model.py ${MODEL_DIR}/join_add_sub/1
286-
cat > ${MODEL_DIR}/join_add_sub/config.pbtxt << 'EOF'
287-
name: "join_add_sub"
288-
backend: "python"
289-
max_batch_size: 1
290-
291-
input [
292-
{
293-
name: "INPUT0"
294-
data_type: TYPE_FP32
295-
dims: [ 1 ]
296-
}
297-
]
298-
input [
299-
{
300-
name: "INPUT1"
301-
data_type: TYPE_FP32
302-
dims: [ 1 ]
303-
}
304-
]
305-
output [
306-
{
307-
name: "OUTPUT0"
308-
data_type: TYPE_FP32
309-
dims: [ 1 ]
310-
}
311-
]
312-
output [
313-
{
314-
name: "OUTPUT1"
315-
data_type: TYPE_FP32
316-
dims: [ 1 ]
317-
}
318-
]
319-
320-
instance_group [{ kind: KIND_CPU }]
321-
EOF
285+
cp ../python_models/join_add_sub/model.py ${MODEL_DIR}/join_add_sub/1
286+
cp ../python_models/join_add_sub/config.pbtxt ${MODEL_DIR}/join_add_sub/
322287

323288
cat > ${MODEL_DIR}/ensemble_parallel_step_failed_enqueue/config.pbtxt << 'EOF'
324289
name: "ensemble_parallel_step_failed_enqueue"
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Copyright 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# Redistribution and use in source and binary forms, with or without
4+
# modification, are permitted provided that the following conditions
5+
# are met:
6+
# * Redistributions of source code must retain the above copyright
7+
# notice, this list of conditions and the following disclaimer.
8+
# * Redistributions in binary form must reproduce the above copyright
9+
# notice, this list of conditions and the following disclaimer in the
10+
# documentation and/or other materials provided with the distribution.
11+
# * Neither the name of NVIDIA CORPORATION nor the names of its
12+
# contributors may be used to endorse or promote products derived
13+
# from this software without specific prior written permission.
14+
#
15+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
16+
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
19+
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21+
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23+
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
27+
name: "join_add_sub"
28+
backend: "python"
29+
max_batch_size: 1
30+
31+
input [
32+
{
33+
name: "INPUT0"
34+
data_type: TYPE_FP32
35+
dims: [ 1 ]
36+
}
37+
]
38+
input [
39+
{
40+
name: "INPUT1"
41+
data_type: TYPE_FP32
42+
dims: [ 1 ]
43+
}
44+
]
45+
output [
46+
{
47+
name: "OUTPUT0"
48+
data_type: TYPE_FP32
49+
dims: [ 1 ]
50+
}
51+
]
52+
output [
53+
{
54+
name: "OUTPUT1"
55+
data_type: TYPE_FP32
56+
dims: [ 1 ]
57+
}
58+
]
59+
60+
instance_group [{ kind: KIND_CPU }]
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Copyright 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# Redistribution and use in source and binary forms, with or without
4+
# modification, are permitted provided that the following conditions
5+
# are met:
6+
# * Redistributions of source code must retain the above copyright
7+
# notice, this list of conditions and the following disclaimer.
8+
# * Redistributions in binary form must reproduce the above copyright
9+
# notice, this list of conditions and the following disclaimer in the
10+
# documentation and/or other materials provided with the distribution.
11+
# * Neither the name of NVIDIA CORPORATION nor the names of its
12+
# contributors may be used to endorse or promote products derived
13+
# from this software without specific prior written permission.
14+
#
15+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
16+
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
19+
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21+
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23+
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
27+
import json
28+
29+
import numpy as np
30+
import triton_python_backend_utils as pb_utils
31+
32+
33+
class TritonPythonModel:
34+
def initialize(self, args):
35+
self.model_config = model_config = json.loads(args["model_config"])
36+
37+
output0_config = pb_utils.get_output_config_by_name(model_config, "OUTPUT0")
38+
output1_config = pb_utils.get_output_config_by_name(model_config, "OUTPUT1")
39+
40+
self.output0_dtype = pb_utils.triton_string_to_numpy(
41+
output0_config["data_type"]
42+
)
43+
self.output1_dtype = pb_utils.triton_string_to_numpy(
44+
output1_config["data_type"]
45+
)
46+
47+
def execute(self, requests):
48+
output0_dtype = self.output0_dtype
49+
output1_dtype = self.output1_dtype
50+
51+
responses = []
52+
for request in requests:
53+
in_0 = pb_utils.get_input_tensor_by_name(request, "INPUT0")
54+
in_1 = pb_utils.get_input_tensor_by_name(request, "INPUT1")
55+
if (
56+
in_0.as_numpy().dtype.type is np.bytes_
57+
or in_0.as_numpy().dtype == np.object_
58+
):
59+
out_0, out_1 = (
60+
in_0.as_numpy().astype(np.int32) + in_1.as_numpy().astype(np.int32),
61+
in_0.as_numpy().astype(np.int32) - in_1.as_numpy().astype(np.int32),
62+
)
63+
else:
64+
out_0, out_1 = (
65+
in_0.as_numpy() + in_1.as_numpy(),
66+
in_0.as_numpy() - in_1.as_numpy(),
67+
)
68+
69+
out_tensor_0 = pb_utils.Tensor("OUTPUT0", out_0.astype(output0_dtype))
70+
out_tensor_1 = pb_utils.Tensor("OUTPUT1", out_1.astype(output1_dtype))
71+
responses.append(pb_utils.InferenceResponse([out_tensor_0, out_tensor_1]))
72+
return responses

0 commit comments

Comments
 (0)