Repository navigation
Add an ExecuTorch inference node - #69
Draft
shoumikhin wants to merge 1 commit into
Draft
shoumikhin wants to merge 1 commit into
shoumikhin wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds.
isaac_ros_executorchruns a model exported to an ExecuTorch program (.pte) on the sameTensorListtopics, with the same tensor name parameters, asTensorRTNode. 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.exportto one program.In a graph. In the DOPE graph from
isaac_ros_dope, with only the inference node swapped:Before this can merge
executorch_conversionsfrom Add executorch_conversions and the ExecuTorch vendor packages ros2/rosidl_buffer_backends#36 (open), which turns CUDA buffers into ExecuTorch tensors in place, liketensorrt_conversionsdoes here. Until it is released,rosdepcannot resolve it.TensorRTNodeuses TensorRT 10.16 from JetPack, so the two nodes cannot share a process.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
erfinvon 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.