-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor TensorFlow operator into base and Triton runtime operator (#219
) * Split out PredictTensorflow into two Operators Co-authored-by: Karl Higley <[email protected]> Co-authored-by: Julio Perez <[email protected]> * raise NotImplementedError in InferenceOperator export abstractmethod Co-authored-by: Julio Perez <[email protected]> Co-authored-by: Karl Higley <[email protected]> * Move Tensorflow Triton op to Triton Runtime module Co-authored-by: Julio Perez <[email protected]> Co-authored-by: Karl Higley <[email protected]> * Move triton runtime code to subdirectory Co-authored-by: Julio Perez <[email protected]> Co-authored-by: Karl Higley <[email protected]> * Use importlib.resources to find oprunner model * Use importlib.resources to find workflow_model.py * Move TritonOperator to operator module * Move `_tf_model_name` from base tensorflow op to triton op * Construct InferenceResponse correctly when an error occurs * Add docstrings to TritonOperator * Remove `exportable_backends` from `PredictTensorflow`, add docstrings Co-authored-by: Karl Higley <[email protected]> Co-authored-by: Julio Perez <[email protected]>
- Loading branch information
1 parent
dff7b02
commit d2737da
Showing
13 changed files
with
375 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# flake8: noqa | ||
from merlin.systems.dag.runtimes.triton.runtime import ( # noqa | ||
TritonEnsembleRuntime, | ||
TritonExecutorRuntime, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
from typing import List | ||
|
||
from merlin.systems.dag.ops.operator import InferenceOperator | ||
|
||
|
||
class TritonOperator: | ||
"""Base class for Triton operators.""" | ||
|
||
def __init__(self, base_op: InferenceOperator): | ||
"""Construct TritonOperator from a base operator. | ||
Parameters | ||
---------- | ||
base_op : merlin.systems.dag.ops.operator.InfereneOperator | ||
Base operator used to construct this Triton op. | ||
""" | ||
self.op = base_op | ||
|
||
@property | ||
def export_name(self): | ||
""" | ||
Provides a clear common english identifier for this operator. | ||
Returns | ||
------- | ||
String | ||
Name of the current class as spelled in module. | ||
""" | ||
return self.__class__.__name__.lower() | ||
|
||
@property | ||
def exportable_backends(self) -> List[str]: | ||
"""Returns list of supported backends. | ||
Returns | ||
------- | ||
List[str] | ||
List of supported backends | ||
""" | ||
return ["ensemble", "executor"] |
Oops, something went wrong.