-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
[adam] Add not torch.jit.is_scripting() as a requirement for switching to fused #92181
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/92181
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 5c8a812: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
all_tensors = [] | ||
all_tensors.extend(params) | ||
all_tensors.extend(grads) | ||
all_tensors.extend(exp_avgs) | ||
all_tensors.extend(exp_avg_sqs) | ||
all_tensors.extend(max_exp_avg_sqs) | ||
all_tensors.extend(state_steps) |
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.
Couldn't you refactor into a nice single itertools.chain, that way you don't need any temporary list at all.
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.
I started with that, but it does not play well with JIT bindings: #91896 (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.
I see, which is annoying because jit bindings shouldn't be necessary since this path isn't part possible under JIT.
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.
The seven lines can be changed into just 1 line, no?
all_tensors = [*params, *grads, *exp_avgs, *exp_avg_sqs, *max_exp_avg_sqs, *state_steps]
@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 |
A "fix" following #90865. Realized that fused is not compatible with torch.jit.is_scripting() when looking at a later line.
Took the opportunity to make the code cleaner/slightly more performant (with the extends) as well.