Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

janeyx99
Copy link
Contributor

@janeyx99 janeyx99 commented Jan 13, 2023

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.

@janeyx99 janeyx99 requested a review from albanD as a code owner January 13, 2023 22:30
@pytorch-bot
Copy link

pytorch-bot bot commented Jan 13, 2023

🔗 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 Failures

As of commit 5c8a812:
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@janeyx99 janeyx99 changed the title Add not torch.jit.is_scripting() as a requirement for switching to fused [adam] Add not torch.jit.is_scripting() as a requirement for switching to fused Jan 13, 2023
@janeyx99 janeyx99 added release notes: nn release notes category topic: performance topic category labels Jan 13, 2023
Comment on lines +319 to +325
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)
Copy link
Collaborator

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.

Copy link
Contributor Author

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)

Copy link
Collaborator

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.

Copy link
Member

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]

@janeyx99
Copy link
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jan 14, 2023
@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request Merged release notes: nn release notes category topic: performance topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants