Here we provide examples of Torch-TensorRT compilation of popular computer vision and language models.
Dependencies¶
Please install the following external dependencies (assuming you already have correct torch, torch_tensorrt and tensorrt libraries installed (dependencies))
pip install -r requirements.txt
Model Zoo¶
Compiling ResNet with dynamic shapes using the torch.compile backend: Compiling a ResNet model using the Torch Compile Frontend for
torch_tensorrt.compileCompiling BERT using the torch.compile backend: Compiling a Transformer model using
torch.compileCompiling Stable Diffusion model using the torch.compile backend: Compiling a Stable Diffusion model using
torch.compile_torch_compile_gpt2: Compiling a GPT2 model using
torch.compile_torch_export_gpt2: Compiling a GPT2 model using AOT workflow (ir=dynamo)
_torch_export_llama2: Compiling a Llama2 model using AOT workflow (ir=dynamo)
_torch_export_sam2: Compiling SAM2 model using AOT workflow (ir=dynamo)
_torch_export_flux_dev: Compiling FLUX.1-dev model using AOT workflow (ir=dynamo)
Debugging Torch-TensorRT Compilation: Debugging Torch-TensorRT Compilation
Compiling Stable Diffusion model using the torch.compile backend
sphx_glr_tutorials__rendered_examples_dynamo_cross_runtime_compilation_for_windows.py
Refitting Torch-TensorRT Programs with New Weights
Compiling GPT2 using the Torch-TensorRT torch.compile frontend
Compiling ResNet with dynamic shapes using the torch.compile backend
Compiling FLUX.1-dev model using the Torch-TensorRT dynamo backend
Automatically Generate a Converter for a Custom Kernel
Automatically Generate a Plugin for a Custom Kernel
sphx_glr_tutorials__rendered_examples_dynamo_aot_plugin.py
Overloading Torch-TensorRT Converters with Custom Converters
Using Custom Kernels with NVRTC in TensorRT AOT Plugins
sphx_glr_tutorials__rendered_examples_dynamo_llama2_flashinfer_rmsnorm.py
Using Custom Kernels within TensorRT Engines with Torch-TensorRT