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

Add capturable ASGD impl #107857

Closed
wants to merge 25 commits into from
Closed

Add capturable ASGD impl #107857

wants to merge 25 commits into from

Conversation

mlazos
Copy link
Contributor

@mlazos mlazos commented Aug 24, 2023

@pytorch-bot pytorch-bot bot added the release notes: optimizer Relating to optimizers, torch.optim label Aug 24, 2023
@pytorch-bot
Copy link

pytorch-bot bot commented Aug 24, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/107857

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 2 Unrelated Failures

As of commit d072d9d with merge base ce03b78 (image):

NEW FAILURE - The following job has failed:

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.

@mlazos mlazos changed the title Add capurable ASGD impl Add capturable ASGD impl Aug 24, 2023
torch/optim/asgd.py Outdated Show resolved Hide resolved
Copy link
Contributor

@janeyx99 janeyx99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two overall points:

  1. we would have to make capturable public and thus we should do our due diligence in adding tests, documentation and any checks to ascertain legitimacy. If you want code pointers, see my NAdam PR [NAdam] Add capturable API and tests + fix differentiable #106615
  2. it would be good to not have our implementation be extremely split up into a huge if else block. I've written up some suggestions that should just make the OG implementation capturable. I did just use GitHub comment as my IDE so the disclaimer is that you should definitely verify with tests/linting 😛

torch/optim/asgd.py Show resolved Hide resolved
torch/optim/asgd.py Outdated Show resolved Hide resolved
torch/optim/asgd.py Outdated Show resolved Hide resolved
torch/optim/asgd.py Outdated Show resolved Hide resolved
torch/optim/asgd.py Outdated Show resolved Hide resolved
torch/optim/asgd.py Outdated Show resolved Hide resolved
@mlazos mlazos added the ciflow/trunk Trigger trunk jobs on your pull request label Aug 30, 2023
@mlazos mlazos requested a review from janeyx99 August 31, 2023 22:51
Copy link
Contributor

@janeyx99 janeyx99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks almost there--thanks for adding tests.

torch/optim/asgd.py Show resolved Hide resolved
torch/optim/asgd.py Show resolved Hide resolved
torch/optim/asgd.py Show resolved Hide resolved
torch/_inductor/decomposition.py Outdated Show resolved Hide resolved
torch/optim/asgd.py Outdated Show resolved Hide resolved
torch/optim/asgd.py Show resolved Hide resolved
torch/optim/asgd.py Show resolved Hide resolved
test/test_cuda.py Show resolved Hide resolved
test/optim/test_optim.py Outdated Show resolved Hide resolved
torch/optim/asgd.py Outdated Show resolved Hide resolved
Copy link
Contributor

@janeyx99 janeyx99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are redundant tests but looks fine overall, thanks!

@mlazos
Copy link
Contributor Author

mlazos commented Sep 7, 2023

@pytorchbot merge

@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

@pytorchmergebot
Copy link
Collaborator

@mlazos
Copy link
Contributor Author

mlazos commented Sep 7, 2023

@pytorchbot merge -f "Unrelated failures"

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

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

janeyx99 added a commit that referenced this pull request Mar 7, 2024
tfsingh I got to it first--wanted to land this stack and close the gap ASAP.

This PR also fixes a discrepancy between `_init_group` and `__set_state__` because we have the constants live on params' device always.

There are some next steps though:
- ASGD can be made faster by making etas, mus, steps be on CPU when NOT capturable. (I had mistakenly thought foreachifying was faster and so we landed #107857, but it is slower). No one has complained yet though.  ¯\_(ツ)_/¯




cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 kadeng muchulee8 aakhundov ColinPeppler amjames desertfire chauhang

[ghstack-poisoned]
janeyx99 added a commit that referenced this pull request Mar 7, 2024
tfsingh I got to it first--wanted to land this stack and close the gap ASAP.

This PR also fixes a discrepancy between `_init_group` and `__set_state__` because we have the constants live on params' device always.

There are some next steps though:
- ASGD can be made faster by making etas, mus, steps be on CPU when NOT capturable. (I had mistakenly thought foreachifying was faster and so we landed #107857, but it is slower). No one has complained yet though.  ¯\_(ツ)_/¯




cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 kadeng muchulee8 aakhundov ColinPeppler amjames desertfire chauhang

[ghstack-poisoned]
pytorchmergebot pushed a commit that referenced this pull request Mar 8, 2024
@tfsingh I got to it first--wanted to land this stack and close the gap ASAP.

This PR also fixes a discrepancy between `_init_group` and `__set_state__` because we have the constants live on params' device always.

There are some next steps though:
- ASGD can be made faster by making etas, mus, steps be on CPU when NOT capturable. (I had mistakenly thought foreachifying was faster and so we landed #107857, but it is slower). No one has complained yet though.  ¯\_(ツ)_/¯

Pull Request resolved: #121264
Approved by: https://github.com/albanD
ghstack dependencies: #121260
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged module: inductor release notes: optimizer Relating to optimizers, torch.optim
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants