Skip to content

[2.15] Backport #4881: do not retrace by default when saving a .pte - #4912

Closed
shoumikhin wants to merge 2 commits into
pytorch:release/2.15from
shoumikhin:backport-2.15-4881
Closed

shoumikhin wants to merge 2 commits into
pytorch:release/2.15from
shoumikhin:backport-2.15-4881

Conversation

@shoumikhin

Copy link
Copy Markdown
Contributor

Backport of #4881 to release/2.15.

Depends on the #4839 backport (#4910). This change updates the ExecuTorch guide that #4839 adds, so it is built on top of that backport. Until that one merges, this branch also carries the #4839 commit. Please review only the last commit.

In 2.15, the shortest way to write an ExecuTorch file fails:

torch_tensorrt.save(trt_gm, "model.pte", output_format="executorch")
# ValueError: ... retrace is True, however no inputs specs were provided ...

save() retraces by default, while torch_tensorrt.executorch.export() does not, so the two entry points disagree. With this change save() does not retrace for "executorch" unless asked. Other formats keep retracing by default, and an explicit retrace= still wins.

This is a clean git cherry-pick -x of the merge commit on top of the #4839 backport, with no conflicts. The patch is identical to #4881.

Validation:

Co-authored-by: shoumikhin <shoumikhin@users.noreply.github.com>
(cherry picked from commit db538e1)
@github-actions github-actions Bot added documentation Improvements or additions to documentation component: tests Issues re: Tests component: api [Python] Issues re: Python API component: api [C++] Issues re: C++ API labels Oct 21, 2026
@meta-cla meta-cla Bot added the cla signed label Oct 21, 2026
…ch#4881)

Co-authored-by: shoumikhin <shoumikhin@users.noreply.github.com>
(cherry picked from commit 17b56b8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed component: api [C++] Issues re: C++ API component: api [Python] Issues re: Python API component: tests Issues re: Tests documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant