Skip to content

Add an ExecuTorch inference node - #69

Draft
shoumikhin wants to merge 1 commit into
NVIDIA-ISAAC-ROS:mainfrom
shoumikhin:executorch
Draft

shoumikhin wants to merge 1 commit into
NVIDIA-ISAAC-ROS:mainfrom
shoumikhin:executorch

Conversation

@shoumikhin

Copy link
Copy Markdown

What this adds. isaac_ros_executorch runs a model exported to an ExecuTorch program (.pte) on the same TensorList topics, with the same tensor name parameters, as TensorRTNode. ExecuTorch is PyTorch's solution for deploying models on devices. The program can hold TensorRT parts (built by Torch-TensorRT, no ONNX file) and CUDA parts in one file. Many PyTorch operators that TensorRT cannot convert can run on the CUDA part, with no TensorRT plugin. The node does not load PyTorch.

Why. Today a model with an operator TensorRT cannot convert needs a custom TensorRT plugin or the Triton node. With this node it can go from torch.export to one program.

In a graph. In the DOPE graph from isaac_ros_dope, with only the inference node swapped:

  • Jetson Orin Nano: about 2.42 frames per second with either node.
  • Jetson AGX Thor: about 9.26 frames per second with either node.
  • The container used less memory with this node in every run.
  • Every frame had a detection with both nodes, and the poses matched.

Before this can merge

I am opening it as a draft to get your view on the shape first. To try it before merge, use this pull request's branch in the README's first step.

Tested

  • x86_64 with an H100: the README steps in a new directory, with a TensorRT-only program, a TensorRT plus CUDA program, and a model with erfinv on the CUDA part. The test client got 200 of 200 correct replies for each.
  • colcon test: the linters the other packages use, and a launch test that runs a small CPU program through the node.
  • Jetson Orin Nano, JetPack 7.2.1, Isaac ROS 5.1 apt packages: this branch built with colcon, and the README's launch file with the test client got 35 of 35 correct replies on frames from the DOPE sample recording.
  • The DOPE graph numbers above, on Orin Nano and AGX Thor, are from an earlier version of this node.

Add isaac_ros_executorch, a node that runs a model exported with
Torch-TensorRT to an ExecuTorch program (.pte), on the same
isaac_ros_tensor_msgs/TensorList topics and with the same tensor name
parameters as the TensorRT node.

Today a model reaches TensorRTNode as an ONNX file, with TensorRT
plugins for operators TensorRT cannot convert, or goes to the Triton
node. Here the model goes from torch.export straight to TensorRT with no
ONNX file. Standard PyTorch operators that TensorRT cannot convert can
run on ExecuTorch's CUDA backend in the same program, when PyTorch's
compiler can generate GPU code for them; this was tested with erfinv.
The node does not load PyTorch.

- ExecuTorchNode (nvidia::isaac_ros::dnn_inference::ExecuTorchNode): an
  rclcpp component. It reads input tensors in CUDA buffers in place and
  writes outputs straight into the reply's CUDA buffer, on one CUDA
  stream it owns. Like TensorRTNode it takes the input_qos and
  output_qos parameters and turns on intra-process communication. It
  takes the .ptd data files the export writes for CUDA backend parts,
  skips messages without data or with another name, shape or data type,
  and names the ExecuTorch error when loading or running fails.
- tensor_list_client: a test tool that sends recorded frames and checks
  the replies.
- scripts/export_dope.py and scripts/export_erfinv.py: export DOPE from
  Isaac ROS's own dope_converter.py, and a small model with an operator
  TensorRT cannot convert.
- test/: a launch test that runs a small CPU program through the node
  and checks that it skips bad messages, plus the linters the other
  packages use.

Before this can merge, executorch_conversions needs to be released from
the open pull request ros2/rosidl_buffer_backends#36, and the
ExecuTorch TensorRT backend, which comes from a pip wheel today, needs
a ROS package. The node uses TensorRT 11.4 from pip, so it must run in
another process than TensorRTNode, which uses TensorRT 10.16.

Signed-off-by: Anthony Shoumikhin <anthony@shoumikh.in>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant