Skip to content

Commit

Permalink
Enhanced python_backend autocomplete (#6504)
Browse files Browse the repository at this point in the history
* Added testing for python_backend autocomplete: optional input and model_transaction_policy
  • Loading branch information
oandreeva-nv authored Nov 2, 2023
1 parent b0d4612 commit 4985ab9
Show file tree
Hide file tree
Showing 28 changed files with 1,014 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
input [
{
name: "INPUT0"
data_type: TYPE_FP32
dims: [ 4 ]
},
{
name: "INPUT1"
data_type: TYPE_FP32
dims: [ 4 ]
}
]
output [
{
name: "OUTPUT0"
data_type: TYPE_FP32
dims: [ 4 ]
},
{
name: "OUTPUT1"
data_type: TYPE_FP32
dims: [ 4 ]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
model transaction property in auto-complete-config function for model 'model_transaction_policy_invalid_args' contains property other than 'decoupled'
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of NVIDIA CORPORATION nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


class TritonPythonModel:
@staticmethod
def auto_complete_config(auto_complete_model_config):
input0 = {"name": "INPUT0", "data_type": "TYPE_FP32", "dims": [4]}
input1 = {"name": "INPUT1", "data_type": "TYPE_FP32", "dims": [4]}
output0 = {"name": "OUTPUT0", "data_type": "TYPE_FP32", "dims": [4]}
output1 = {"name": "OUTPUT1", "data_type": "TYPE_FP32", "dims": [4]}
transaction_policy = {"invalid": "argument"}

auto_complete_model_config.set_max_batch_size(4)
auto_complete_model_config.set_model_transaction_policy(transaction_policy)
auto_complete_model_config.add_input(input0)
auto_complete_model_config.add_input(input1)
auto_complete_model_config.add_output(output0)
auto_complete_model_config.add_output(output1)

return auto_complete_model_config

def execute(self, requests):
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
model_transaction_policy {
decoupled: false
}

input [
{
name: "INPUT0"
data_type: TYPE_FP32
dims: [ 4 ]
},
{
name: "INPUT1"
data_type: TYPE_FP32
dims: [ 4 ]
}
]
output [
{
name: "OUTPUT0"
data_type: TYPE_FP32
dims: [ 4 ]
},
{
name: "OUTPUT1"
data_type: TYPE_FP32
dims: [ 4 ]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
trying to change decoupled property in auto-complete-config for model 'model_transaction_policy_mismatch', which is already set to 'False'
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of NVIDIA CORPORATION nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


class TritonPythonModel:
@staticmethod
def auto_complete_config(auto_complete_model_config):
input0 = {"name": "INPUT0", "data_type": "TYPE_FP32", "dims": [4]}
input1 = {"name": "INPUT1", "data_type": "TYPE_FP32", "dims": [4]}
output0 = {"name": "OUTPUT0", "data_type": "TYPE_FP32", "dims": [4]}
output1 = {"name": "OUTPUT1", "data_type": "TYPE_FP32", "dims": [4]}

auto_complete_model_config.set_max_batch_size(4)
auto_complete_model_config.set_model_transaction_policy(dict(decoupled=True))
auto_complete_model_config.add_input(input0)
auto_complete_model_config.add_input(input1)
auto_complete_model_config.add_output(output0)
auto_complete_model_config.add_output(output1)

return auto_complete_model_config

def execute(self, requests):
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
input [
{
name: "INPUT0"
data_type: TYPE_FP32
dims: [ 4 ]
},
{
name: "INPUT1"
data_type: TYPE_FP32
dims: [ 4 ]
}
]
output [
{
name: "OUTPUT0"
data_type: TYPE_FP32
dims: [ 4 ]
},
{
name: "OUTPUT1"
data_type: TYPE_FP32
dims: [ 4 ]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "model_transaction_policy"
version_policy {
latest {
num_versions: 1
}
}
max_batch_size: 4
input {
name: "INPUT0"
data_type: TYPE_FP32
dims: 4
}
input {
name: "INPUT1"
data_type: TYPE_FP32
dims: 4
}
output {
name: "OUTPUT0"
data_type: TYPE_FP32
dims: 4
}
output {
name: "OUTPUT1"
data_type: TYPE_FP32
dims: 4
}
instance_group {
name: "model_transaction_policy"
count: 1
gpus: 0
kind: KIND_GPU
}
default_model_filename: "model.py"
optimization {
input_pinned_memory {
enable: true
}
output_pinned_memory {
enable: true
}
}
backend: "python"
model_transaction_policy {
decoupled: true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "model_transaction_policy"
version_policy {
latest {
num_versions: 1
}
}
max_batch_size: 4
input {
name: "INPUT1"
data_type: TYPE_FP32
dims: 4
}
input {
name: "INPUT0"
data_type: TYPE_FP32
dims: 4
}
output {
name: "OUTPUT0"
data_type: TYPE_FP32
dims: 4
}
output {
name: "OUTPUT1"
data_type: TYPE_FP32
dims: 4
}
instance_group {
name: "model_transaction_policy"
count: 1
gpus: 0
kind: KIND_GPU
}
default_model_filename: "model.py"
optimization {
input_pinned_memory {
enable: true
}
output_pinned_memory {
enable: true
}
}
backend: "python"
model_transaction_policy {
decoupled: true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "model_transaction_policy"
version_policy {
latest {
num_versions: 1
}
}
max_batch_size: 4
input {
name: "INPUT0"
data_type: TYPE_FP32
dims: 4
}
input {
name: "INPUT1"
data_type: TYPE_FP32
dims: 4
}
output {
name: "OUTPUT1"
data_type: TYPE_FP32
dims: 4
}
output {
name: "OUTPUT0"
data_type: TYPE_FP32
dims: 4
}
instance_group {
name: "model_transaction_policy"
count: 1
gpus: 0
kind: KIND_GPU
}
default_model_filename: "model.py"
optimization {
input_pinned_memory {
enable: true
}
output_pinned_memory {
enable: true
}
}
backend: "python"
model_transaction_policy {
decoupled: true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "model_transaction_policy"
version_policy {
latest {
num_versions: 1
}
}
max_batch_size: 4
input {
name: "INPUT1"
data_type: TYPE_FP32
dims: 4
}
input {
name: "INPUT0"
data_type: TYPE_FP32
dims: 4
}
output {
name: "OUTPUT1"
data_type: TYPE_FP32
dims: 4
}
output {
name: "OUTPUT0"
data_type: TYPE_FP32
dims: 4
}
instance_group {
name: "model_transaction_policy"
count: 1
gpus: 0
kind: KIND_GPU
}
default_model_filename: "model.py"
optimization {
input_pinned_memory {
enable: true
}
output_pinned_memory {
enable: true
}
}
backend: "python"
model_transaction_policy {
decoupled: true
}
Loading

0 comments on commit 4985ab9

Please sign in to comment.