Skip to content

Commit

Permalink
TensorRT installation warning for onnx_to_trt (nv-morpheus#23)
Browse files Browse the repository at this point in the history
* tensorrt installation warning for onnx_to_trt

* Update cli.py

* .

* .

* add better error message for tensorrt requirement, add tensorrt to sphinx mocks
  • Loading branch information
cwharris authored Apr 25, 2022
1 parent f6f3f62 commit c352335
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
autodoc_mock_imports = [
"morpheus.cli", # Dont document the CLI in Sphinx
"tqdm",
"tensorrt",
]

# Config numpydoc
Expand Down
15 changes: 14 additions & 1 deletion morpheus/utils/onnx_to_trt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import logging

from morpheus.config import ConfigOnnxToTRT

logger = logging.getLogger(__name__)

try:
import tensorrt as trt
except ImportError:
logger.error("The onnx_to_trt module requires the TensorRT runtime and python package to be installed. "
"To install the `tensorrt` python package, follow the instructions located "
"here: https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#installing-pip")
raise



def gen_engine(c: ConfigOnnxToTRT):
"""
Expand All @@ -27,7 +40,7 @@ def gen_engine(c: ConfigOnnxToTRT):
"""

# Local imports to avoid requiring TensorRT to generate the docs
import tensorrt as trt

TRT_LOGGER = trt.Logger()

input_model = c.input_model
Expand Down

0 comments on commit c352335

Please sign in to comment.