CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 24.7k
[export] fix joint graph metadata #136011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
đź”— Helpful Linksđź§Ş See artifacts and rendered test results at hud.pytorch.org/pr/136011
Note: Links to docs will display an error until the docs builds have been completed. âś… You can merge normally! (2 Unrelated Failures)As of commit 31f509c with merge base c0a930b ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D62652832 |
Summary: Pull Request resolved: pytorch/pytorch#136011 Differential Revision: D62652832
Summary: Fixes up missing metadata on export -> joint graph export, with patching in AOTAutograd so tracer knows to record nn_module_stack X-link: pytorch/executorch#5447 Test Plan: test_experimental Differential Revision: D62652832
353b9e6
to
5b57952
Compare
This pull request was exported from Phabricator. Differential Revision: D62652832 |
torch/_functorch/aot_autograd.py
Outdated
@@ -1301,7 +1301,8 @@ def flattened_joint(*args): | |||
assert grad is None | |||
return *fw_outs, *output_gradients | |||
|
|||
fx_g = make_fx(flattened_joint)(*full_args) | |||
flattened_joint._orig_mod = fx_g |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use functools.wraps to get the orig mod? Can you also reference this note here https://github.com/pytorch/pytorch/pull/115454/files#diff-594ef3e84a8e3555bfa4a6167383949da5f321e93f602246eb9c0a797d5ecc00R617
cc: @bdhirsh
inputs = (x, labels) | ||
|
||
ep = export(net, inputs) | ||
ep = _export_forward_backward(ep) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does the test failure look like without your fix? (if _orig_mod
isn't properly plumbed in AOTAutograd).
It feels pretty easy to add a new wrapper at some point and forget to propagate the orig_mod, so we probably want it to error in a loud/obvious way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bdhirsh it crashes at the ExportedProgram verifier, as nn_module_stack and other metadata is missing for the graph.
I think it affects this line, where ModuleStackTracer populates the metadata:
pytorch/torch/fx/experimental/proxy_tensor.py
Lines 1872 to 1876 in 4d3c0fc
if hasattr(f, "_orig_mod") and self.record_module_stack: | |
scope_root = f._orig_mod | |
self.fx_tracer = _ModuleStackTracer(scope_root) | |
else: | |
self.fx_tracer = PythonKeyTracer() |
5b57952
to
1982c1f
Compare
This pull request was exported from Phabricator. Differential Revision: D62652832 |
Summary: Fixes up missing metadata on export -> joint graph export, with patching in AOTAutograd so tracer knows to record nn_module_stack X-link: pytorch/executorch#5447 Test Plan: test_experimental Differential Revision: D62652832
1982c1f
to
156b78e
Compare
This pull request was exported from Phabricator. Differential Revision: D62652832 |
updated to use functool.wraps on flattened_joint, let's see if this breaks anything |
Summary: Fixes up missing metadata on export -> joint graph export, with patching in AOTAutograd so tracer knows to record nn_module_stack X-link: pytorch/executorch#5447 Test Plan: test_experimental Differential Revision: D62652832
156b78e
to
56ab88e
Compare
This pull request was exported from Phabricator. Differential Revision: D62652832 |
56ab88e
to
93d0b60
Compare
This pull request was exported from Phabricator. Differential Revision: D62652832 |
Summary: Fixes up missing metadata on export -> joint graph export, with patching in AOTAutograd so tracer knows to record nn_module_stack X-link: pytorch/executorch#5447 Test Plan: test_experimental Reviewed By: tugsbayasgalan Differential Revision: D62652832
93d0b60
to
31f509c
Compare
This pull request was exported from Phabricator. Differential Revision: D62652832 |
@pytorchbot merge -f 'Landed internally' (Initiating merge automatically since Phabricator Diff has merged, using force because this PR might not pass merge_rules.json but landed internally) |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Differential Revision: D62652832