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

Fix self.optimizers() not returning a single LightningOptimizer #8326

Merged
merged 2 commits into from
Jul 7, 2021

Conversation

carmocca
Copy link
Contributor

@carmocca carmocca commented Jul 7, 2021

What does this PR do?

When using deepspeed, the optimizers are wrapped and self.optimizers() returned a list. This means that changing the plugin needs a code change. This PR fixes it.

Found in #8071

Does your PR introduce any breaking changes? If yes, please list them.

  • Users relying on the previous (bug) behaviour will get a TypeError.
  • is_lightning_optimizer is removed. But seems like a silly function to have, isinstance is the pythonic check. Should be okay as the LightningOptimizer is internal and invisible to users.

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • [n/a] Did you make sure to update the documentation with your changes? (if necessary)
  • [n/a] Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)
  • Did you list all the breaking changes introduced by this pull request?

PR review

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

@carmocca carmocca added the bug Something isn't working label Jul 7, 2021
@carmocca carmocca added this to the v1.4 milestone Jul 7, 2021
@carmocca carmocca self-assigned this Jul 7, 2021
@codecov
Copy link

codecov bot commented Jul 7, 2021

Codecov Report

Merging #8326 (434b6ad) into master (fc12fe7) will decrease coverage by 0%.
The diff coverage is 80%.

@@          Coverage Diff           @@
##           master   #8326   +/-   ##
======================================
- Coverage      92%     92%   -0%     
======================================
  Files         213     213           
  Lines       13808   13806    -2     
======================================
- Hits        12754   12739   -15     
- Misses       1054    1067   +13     

Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGTM ! Nice catch !

@carmocca carmocca added the ready PRs ready to be merged label Jul 7, 2021
Copy link
Contributor

@kaushikb11 kaushikb11 left a comment

Choose a reason for hiding this comment

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

LGTM!

@carmocca carmocca merged commit 398eed5 into master Jul 7, 2021
@carmocca carmocca deleted the bugfix/return-single-litopt branch July 7, 2021 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants