Repository navigation
Add ExecuTorch export example to the export guide - #2298
Open
shoumikhin wants to merge 1 commit into
Open
shoumikhin wants to merge 1 commit into
shoumikhin wants to merge 1 commit into
Conversation
The export guide shows ONNX, and TorchScript for C++. TorchScript is deprecated in PyTorch. Add an "Export to ExecuTorch" section after "Trace/Export to C++". It exports a PPO policy with torch.export to one .pte file, on CPU with the XNNPACK backend and on GPU with TensorRT through Torch-TensorRT, checks the actions against model.predict(deterministic=True), and shows how to run the file from C++. Add a note in the TorchScript section that points to it, a changelog entry, and bump the version to 2.10.0a0 for the new changelog section.
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.
Description
Adds an "Export to ExecuTorch" section to the export guide, after "Trace/Export to C++". It shows how to export a policy with
torch.exportto a.ptefile for the CPU (XNNPACK) or an NVIDIA GPU (TensorRT), check it againstmodel.predict, and run it from C++. The TorchScript section now points to it, since TorchScript is deprecated. Also adds a changelog entry and bumps the version to 2.10.0a0.Motivation and Context
Closes #2297
Types of changes
Checklist
docs/misc/changelog.md) (required).make format(required)make check-codestyleandmake lint(required)make pytestandmake typeboth pass. (required)make doc(required)How it was tested
On Linux x86_64 with an NVIDIA GPU, with SB3 2.9.2, PyTorch 2.15, ExecuTorch 1.6 and Torch-TensorRT 2.15 from PyPI: the snippets run as written, the exported PPO, SAC and TD3 policies match
model.predict, and the C++ example prints the same action as Python.