-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Update torch.autograd.graph logging to not print out grad_output #116523
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
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/116523
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 5257e6b with merge base e5f2ac1 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
albanD
left a comment
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.
SGTM
torch/autograd/graph.py
Outdated
| def prehook(grad_output): | ||
| node = torch._C._current_autograd_node() | ||
| log_str = f"Executing: {node} with grad_output: {grad_output}" | ||
| log_str = f"Executing: {node}" |
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.
If this is too verbose, feel free to only print size to share some information.
…output" [ghstack-poisoned]
|
|
||
| if t is None: | ||
| return "None" | ||
| return f"{dtype_abbrs[t.dtype]}[{', '.join(map(str, t.shape))}]" |
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.
Is that a usual format used in other places?
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.
Yeah, fx and logging tensor also use this format
albanD
left a comment
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.
Change sounds good but needs rebase!
…output" Instead of printing the tensor's data print the dtype and shape metadata of the tensor. ``` Executing: <VarMeanBackward0 object at 0x1352d0e20> with grad_outputs: [None,f32[]] ``` This is important in order to avoid doing a cuda sync and also useful to reduce verbosity. [ghstack-poisoned]
…output" Instead of printing the tensor's data print the dtype and shape metadata of the tensor. ``` Executing: <VarMeanBackward0 object at 0x1352d0e20> with grad_outputs: [None,f32[]] ``` This is important in order to avoid doing a cuda sync and also useful to reduce verbosity. [ghstack-poisoned]
…output" Instead of printing the tensor's data print the dtype and shape metadata of the tensor. ``` Executing: <VarMeanBackward0 object at 0x1352d0e20> with grad_outputs: [None,f32[]] ``` This is important in order to avoid doing a cuda sync and also useful to reduce verbosity. [ghstack-poisoned]
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…d clarify docs (#116710) Pull Request resolved: #116710 Approved by: https://github.com/albanD ghstack dependencies: #116523
…orch#116523) Instead of printing the tensor's data print the dtype and shape metadata of the tensor. ``` Executing: <VarMeanBackward0 object at 0x1352d0e20> with grad_outputs: [None,f32[]] ``` This is important in order to avoid doing a cuda sync and also useful to reduce verbosity. Pull Request resolved: pytorch#116523 Approved by: https://github.com/albanD
…d clarify docs (pytorch#116710) Pull Request resolved: pytorch#116710 Approved by: https://github.com/albanD ghstack dependencies: pytorch#116523
Fixes #116099 Pull Request resolved: #117067 Approved by: https://github.com/lezcano, https://github.com/albanD ghstack dependencies: #116523, #116710
Stack from ghstack (oldest at bottom):
Instead of printing the tensor's data print the dtype and shape metadata of the tensor.
This is important in order to avoid doing a cuda sync and also useful to reduce verbosity.