pytorch/TensorRT
PyTorch/TorchScript/FX compiler for NVIDIA GPUs using TensorRT
What it solves
Torch-TensorRT 提供了一种在 NVIDIA GPU 上加速 PyTorch 模型推理性能的方法。它解决了 eager execution 模式下推理延迟慢的问题,最高可将延迟降低 5 倍。
How it works
它将 NVIDIA 的 TensorRT 优化引擎集成到 PyTorch 生态系统中。用户可以通过两种主要方式应用优化:
- torch.compile:只需一行代码,将后端设置为 "tensorrt",模型将在首次运行时被编译。
- Export workflow:提前优化与序列化的流程,允许模型部署在 PyTorch 或 C++ 环境(通过 libtorch),且不需要 Python 依赖。
Who it’s for
在 NVIDIA 硬件上部署 PyTorch 模型,并需要最大化推理速度和效率的开发者和机器学习工程师。
Highlights
- 高性能推理加速(比 eager execution 快最高 5 倍)。
- 与
torch.compile无缝集成,快速原型开发。 - 支持提前序列化以供 C++ 部署。
- 兼容 Diffusion 模型、Hugging Face 的 LLM,以及 FP8 精度。
- 跨平台支持 Linux(AMD64、SBSA)和 Windows(仅 Dynamo)。