Package: triton-model-navigator
Model optimization plays a crucial role in unlocking the maximum performance capabilities of the underlying hardware. By
applying various transformation techniques, models can be optimized to fully utilize the specific features offered by
the hardware architecture to improve the inference performance and cost. Furthermore, in many cases allow for
serialization of models, separating them from the source code. The serialization process enhances portability, allowing
the models to be seamlessly deployed in production environments. The decoupling of models from the source code also
facilitates maintenance, updates, and collaboration among developers. However, this process comprises multiple steps and
offers various potential paths, making manual execution complicated and time-consuming.TheTriton Model Navigatoroffers a user-friendly and
automated solution for optimizing and deploying machine learning models. Using a single entry point for
various supported frameworks, allowing users to start the process of searching for the best deployment option with a
single call to the dedicatedoptimizefunction. Model Navigator handles model export, conversion, correctness testing,
and profiling to select optimal model format and save generated artifacts for inference deployment on thePyTritonorTriton Inference Server.The Model Navigator generates multiple optimized and production-ready models.
The table below illustrates the model formats that can be obtained by using the Model Navigator with various frameworks.Table:Supported conversion target formats per each supported Python framework or file.Target Formats for FrameworksPyTorchTensorFlow2JAXONNXTorch 2 CompileSavedModelSavedModelTensorRTTorchScript TraceTensorRT in TensorFlowTensorRT in TensorFlowTorchScript ScriptONNXONNXTorchTensorRTTensorRTTensorRTONNXTensorRTNote:The Model Navigator has the capability to support any Python function as input.
However, in this particular case, its role is limited to profiling the function without generating any serialized models.The Model Navigator stores all artifacts within thenavigator_workspace.
Additionally, it provides the option to save a portable and transferableNavigator Packagethat includes only the models with minimal latency and maximal throughput.
This package also includes base formats that can be used to regenerate theTensorRTplan on the target hardware.Table:Model formats that can be generated from savedNavigator Packageand from model sources.Target Formats for InputsModel SourceNavigator PackageSavedModelTorchTensorRTTensorRT in TensorFlowTensorRT in TensorFlowTorchScript TraceONNXTorchScript ScriptTensorRTTorchTensorRTONNXTensorRTInstallationThe package can be installed using extra index url:pip install -U --extra-index-url https://pypi.ngc.nvidia.com triton-model-navigator[<extras,>]or with nvidia-pyindex:pip install nvidia-pyindex
pip install -U triton-model-navigator[<extras,>]Extras:tensorflow- Model Navigator with dependencies for TensorFlow2jax- Model Navigator with dependencies for JAXFor using with PyTorch no extras are needed.Quick StartOptimizing models using Model Navigator is as simply as callingoptimizefunction. The optimization process requires
at least:model- a Python object, callable or file path with model to optimize.dataloader- a method or class generating input data. The data is utilized to determine the maximum and minimum
shapes of the model inputs and create output samples that are used during the optimization process.Here is an example of runningoptimizeon Torch Hub ResNet50 model:importloggingimporttorchimportmodel_navigatorasnavnav.torch.optimize(model=torch.hub.load('NVIDIA/DeepLearningExamples:torchhub','nvidia_resnet50',pretrained=True).eval(),dataloader=[torch.randn(1,3,256,256)for_inrange(10)],)Once the model has been optimized the created artifacts are stored innavigator_workspaceand a Package object is
returned from the function. The returned object can be used to createNavigator Packageor deploy model onPyTritonorTriton Inference Server. Read more about it indocumentationExamplesWe provide step-by-step examples that demonstrate how to use various features of Model Navigator.
For the sake of readability and accessibility, we use a simpletorch.nn.Linearmodel as an example.
These examples illustrate how to optimize, test and deploy the model on
the PyTriton and Triton Inference Server.Examples:https://github.com/triton-inference-server/model_navigator/tree/main/examples.LinksDocumentation:https://triton-inference-server.github.io/model_navigatorSource:https://github.com/triton-inference-server/model_navigatorIssues:https://github.com/triton-inference-server/model_navigator/issuesChangelog:https://github.com/triton-inference-server/model_navigator/blob/main/CHANGELOG.mdKnown Issues:https://github.com/triton-inference-server/model_navigator/blob/main/docs/known_issues.mdContributing:https://github.com/triton-inference-server/model_navigator/blob/main/CONTRIBUTING.md