Skip to content

Add ExecuTorch export example to the export guide - #2298

Open
shoumikhin wants to merge 1 commit into
DLR-RM:masterfrom
shoumikhin:docs-executorch-export
Open

shoumikhin wants to merge 1 commit into
DLR-RM:masterfrom
shoumikhin:docs-executorch-export

Conversation

@shoumikhin

Copy link
Copy Markdown

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.export to a .pte file for the CPU (XNNPACK) or an NVIDIA GPU (TensorRT), check it against model.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

  • I have raised an issue to propose this change (required for new features and bug fixes)

Closes #2297

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)

Checklist

  • I've read the CONTRIBUTION guide (required)
  • I have updated the changelog accordingly (docs/misc/changelog.md) (required).
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.
  • I have opened an associated PR on the SB3-Contrib repository (if necessary)
  • I have opened an associated PR on the RL-Zoo3 repository (if necessary)
  • I have reformatted the code using make format (required)
  • I have checked the codestyle using make check-codestyle and make lint (required)
  • I have ensured make pytest and make type both pass. (required)
  • I have checked that the documentation builds using 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.

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.
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.

[Documentation] Add an ExecuTorch export example to the export guide

1 participant