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/mismatched toggle optimizer #7563

Merged

Conversation

Lucklyric
Copy link
Contributor

@Lucklyric Lucklyric commented May 15, 2021

What does this PR do?

Fixes #7405

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?
  • NA Did you make sure to update the documentation with your changes? (if necessary)
  • 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)

PR review

Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:

  • 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

Did you have fun?

Make sure you had fun coding 🙃

@codecov
Copy link

codecov bot commented May 15, 2021

Codecov Report

Merging #7563 (4f4f75e) into master (20f6337) will decrease coverage by 4%.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master   #7563    +/-   ##
=======================================
- Coverage      92%     88%    -4%     
=======================================
  Files         197     198     +1     
  Lines       12878   12835    -43     
=======================================
- Hits        11899   11289   -610     
- Misses        979    1546   +567     

@Lucklyric Lucklyric marked this pull request as ready for review May 15, 2021 20:51
Copy link
Contributor

@carmocca carmocca left a comment

Choose a reason for hiding this comment

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

Can you resolve conflicts and add a test?

CHANGELOG.md Outdated Show resolved Hide resolved
@Lucklyric Lucklyric force-pushed the fix/mismatched_toggle_optimizer branch from a4fbea3 to 42b931d Compare May 19, 2021 04:08
@mergify mergify bot removed the has conflicts label May 19, 2021
Refs Lightning-AI#7405

chore: update CHANGELOG

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

fix: resolve a confict

chore: update changelog
@Lucklyric Lucklyric force-pushed the fix/mismatched_toggle_optimizer branch from 42b931d to 032cdad Compare May 19, 2021 04:11
@Lucklyric
Copy link
Contributor Author

Lucklyric commented May 19, 2021

Dear @carmocca , I just resolved the conflict. Because I only changed the place of untoggle_optimizer, those codes seem to be still covered by existing tests.

@carmocca
Copy link
Contributor

I just resolved the conflict

Thanks!

those codes seem to be still covered by existing tests.

Coverage is not enough. Needs a test to ensure the new behaviour is correct and to avoid future regressions

@tchaton
Copy link
Contributor

tchaton commented May 21, 2021

Dear @Lucklyric,

Mind making a test triggering the grad_fn error on master and working there.

Best,
T.C

@Lucklyric
Copy link
Contributor Author

Dear @Lucklyric,

Mind making a test triggering the grad_fn error on master and working there.

Best,
T.C

Will do that. Thank you!

@pep8speaks
Copy link

pep8speaks commented May 22, 2021

Hello @Lucklyric! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-05-22 18:24:33 UTC

@Lucklyric
Copy link
Contributor Author

Dear @carmocca @tchaton , added a test that fails in master and works here. I'm not sure if this is a proper test, so please feel free to provide feedback. Thanks

@tchaton
Copy link
Contributor

tchaton commented May 22, 2021

Hey @Lucklyric @carmoccam confirm this test is failing on master.
Great job there !

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 !

Copy link
Contributor

@carmocca carmocca left a comment

Choose a reason for hiding this comment

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

Some nits. Thanks!

tests/trainer/optimization/test_multiple_optimizers.py Outdated Show resolved Hide resolved
tests/trainer/optimization/test_multiple_optimizers.py Outdated Show resolved Hide resolved
@carmocca carmocca added this to the v1.3.x milestone May 22, 2021
@carmocca carmocca added the bug Something isn't working label May 22, 2021
@Lucklyric
Copy link
Contributor Author

Some nits. Thanks!

Thanks for your comments, @carmocca . Updated!

@carmocca carmocca merged commit 01109cd into Lightning-AI:master May 23, 2021
awaelchli added a commit that referenced this pull request May 25, 2021
awaelchli added a commit that referenced this pull request May 25, 2021
* fix: avoid potential mismatched toggling of optimzier
Refs #7405

chore: update CHANGELOG

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

fix: resolve a confict

chore: update changelog

* feat: add a test that fails in master

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix typo in tests/trainer/optimization/test_multiple_optimizers.py

Co-authored-by: ananthsub <[email protected]>

* Polish tests/trainer/optimization/test_multiple_optimizers.py

Co-authored-by: Carlos Mocholí <[email protected]>

* Polish tests/trainer/optimization/test_multiple_optimizers.py

Co-authored-by: Carlos Mocholí <[email protected]>

* fix: change placeholder in optimizer_step from positional args to keyword args

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: ananthsub <[email protected]>
Co-authored-by: Carlos Mocholí <[email protected]>
fix whitespace


fix parentheses
@Borda Borda mentioned this pull request May 25, 2021
Borda pushed a commit that referenced this pull request May 26, 2021
* fix: avoid potential mismatched toggling of optimzier
Refs #7405

chore: update CHANGELOG

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

fix: resolve a confict

chore: update changelog

* feat: add a test that fails in master

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix typo in tests/trainer/optimization/test_multiple_optimizers.py

Co-authored-by: ananthsub <[email protected]>

* Polish tests/trainer/optimization/test_multiple_optimizers.py

Co-authored-by: Carlos Mocholí <[email protected]>

* Polish tests/trainer/optimization/test_multiple_optimizers.py

Co-authored-by: Carlos Mocholí <[email protected]>

* fix: change placeholder in optimizer_step from positional args to keyword args

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: ananthsub <[email protected]>
Co-authored-by: Carlos Mocholí <[email protected]>
fix whitespace


fix parentheses
lexierule pushed a commit that referenced this pull request May 26, 2021
* fix: avoid potential mismatched toggling of optimzier
Refs #7405

chore: update CHANGELOG

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

fix: resolve a confict

chore: update changelog

* feat: add a test that fails in master

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix typo in tests/trainer/optimization/test_multiple_optimizers.py

Co-authored-by: ananthsub <[email protected]>

* Polish tests/trainer/optimization/test_multiple_optimizers.py

Co-authored-by: Carlos Mocholí <[email protected]>

* Polish tests/trainer/optimization/test_multiple_optimizers.py

Co-authored-by: Carlos Mocholí <[email protected]>

* fix: change placeholder in optimizer_step from positional args to keyword args

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: ananthsub <[email protected]>
Co-authored-by: Carlos Mocholí <[email protected]>
fix whitespace


fix parentheses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Step optimizers at arbitrary intervals
6 participants