Skip to content
AI.info

The Pulse

PyTorch workflow runs robot policies with TensorRT without PyTorch

Torch-TensorRT 2.15 and ExecuTorch 1.6 can compile robot policies into programs that run without loading PyTorch. In tests on an NVIDIA Jetson Orin Nano Super, the teams say the approach came within 4% of an ONNX-TensorRT setup across four policies.

PyTorch workflow runs robot policies with TensorRT without PyTorch

Robot developers can compile PyTorch policies with NVIDIA TensorRT and run the resulting programs on a device without loading PyTorch. The PyTorch and NVIDIA teams describe the ExecuTorch-TensorRT workflow in a November 24 post, including tests on an NVIDIA Jetson Orin Nano Super.

In those tests, the teams say the workflow came within 4% of an ONNX-TensorRT setup on each of four policies. A 3.6-billion-parameter policy ran on the 8 GB board, while PyTorch eager mode ran out of memory.

Compiling for the device

The workflow uses Torch-TensorRT 2.15 to compile a model and save it as an ExecuTorch 1.6 program. The teams describe it as production ready, with a single install, prebuilt C++ libraries and a Python runtime that does not need PyTorch.

It uses PyTorch's torch.export to capture the model rather than passing it through ONNX. Parts that TensorRT cannot convert, including preprocessing, can be sent to ExecuTorch's CUDA backend and run on the GPU within the same program and CUDA stream.

TensorRT builds an engine for each portion it can handle, while the CUDA backend compiles its portion with AOTInductor. The engines are saved in a.pte program file, with the CUDA backend's weights in a separate.ptd data file.

The runtime can keep inputs, outputs and tensors passed between the backends on the GPU. The post also describes an option for recording each engine's GPU work as a CUDA graph and replaying it with a single launch.

Policy benchmarks

The teams tested ACT, SmolVLA, pi0.5 and GR00T 1.7 policies from Hugging Face's LeRobot library on a Jetson Orin Nano Super with 8 GB of memory. All five methods used the same trained weights and inputs, with nothing quantized.

For pi0.5, which has 3.6 billion parameters, ExecuTorch-TensorRT took 467 milliseconds per action chunk and ONNX-TensorRT took 452 milliseconds, according to the post. Torch-TensorRT, torch.compile and PyTorch eager mode ran out of memory on that policy.

The teams report 215 milliseconds per action chunk for a fine-tuned, 3-billion-parameter GR00T 1.7 policy with ExecuTorch-TensorRT, compared with 208 milliseconds using ONNX-TensorRT. In that test, torch.compile and PyTorch eager mode ran out of memory.

Timing was the median of three runs of 100 chunks after 20 warm-up chunks. Memory was measured as the median of three runs over the last 30 seconds of 120 seconds; files the process only reads were not counted. The post notes that differences of a few milliseconds are within run-to-run noise.

Installation and deployment

PyTorch is needed for compilation, but the compiled program can run from C++ or Python without it. The installation packages are built for CUDA 13.2 on Linux, for x86-64 and Arm64; on an NVIDIA Jetson, that requires JetPack 7.2 or newer.

On Arm64, the first installation also downloads about 2.6 GB of TensorRT libraries from NVIDIA. For a robot that only runs models, the post lists a runtime installation of about 4.6 GB, compared with 11 GB for the full installation.

For a custom operation that neither TensorRT nor the CUDA backend can compile, the teams describe writing the operation as a Triton kernel and registering it with torch.library.triton_op. The CUDA backend can then compile it into the program, which runs without Triton or PyTorch installed on the robot.

Sources

  1. Original source · Blog post PyTorch “ExecuTorch-TensorRT: PyTorch Robot Policies at NVIDIA TensorRT Speed” pytorch.org

Related stories

Explore

More articles