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

[bugfix] Add reloading support using BaseFinetuning #7253

Merged
merged 29 commits into from
Apr 30, 2021
Merged

Conversation

tchaton
Copy link
Contributor

@tchaton tchaton commented Apr 28, 2021

What does this PR do?

This PR adds support for reloading the optimizer_state when training with BaseFinetuning.

Fixes #6891

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?
  • 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 🙃

@tchaton tchaton added the bug Something isn't working label Apr 28, 2021
@tchaton tchaton added this to the v1.3 milestone Apr 28, 2021
@tchaton tchaton self-assigned this Apr 28, 2021
@codecov
Copy link

codecov bot commented Apr 28, 2021

Codecov Report

Merging #7253 (bb9eb29) into master (969e857) will decrease coverage by 1%.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master   #7253    +/-   ##
=======================================
- Coverage      91%     90%    -1%     
=======================================
  Files         199     199            
  Lines       12800   13014   +214     
=======================================
+ Hits        11704   11746    +42     
- Misses       1096    1268   +172     

@mergify mergify bot removed the has conflicts label Apr 28, 2021
Copy link
Contributor

@awaelchli awaelchli left a comment

Choose a reason for hiding this comment

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

the signature update could also have been in a separate PR, but LGTM

The only part I am not convinced about is passing the empty state to the hooks. This requires the user to change their implementation if I understand correctly. And it also requires us to update all our callbacks.

pytorch_lightning/callbacks/finetuning.py Outdated Show resolved Hide resolved
pytorch_lightning/trainer/callback_hook.py Outdated Show resolved Hide resolved
pytorch_lightning/trainer/callback_hook.py Outdated Show resolved Hide resolved
tests/deprecated_api/test_remove_1-5.py Outdated Show resolved Hide resolved
tests/deprecated_api/test_remove_1-5.py Outdated Show resolved Hide resolved
tests/deprecated_api/test_remove_1-5.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/base.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/base.py Outdated Show resolved Hide resolved
@tchaton tchaton enabled auto-merge (squash) April 29, 2021 12:13
pytorch_lightning/callbacks/base.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/base.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/base.py Show resolved Hide resolved
pytorch_lightning/callbacks/finetuning.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/finetuning.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/finetuning.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/finetuning.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/finetuning.py Show resolved Hide resolved
pytorch_lightning/callbacks/finetuning.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/finetuning.py Show resolved Hide resolved
@tchaton tchaton added the admin Requires admin privileges to merge label Apr 29, 2021
Copy link
Member

@ethanwharris ethanwharris left a comment

Choose a reason for hiding this comment

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

LGTM, small query

tests/callbacks/test_finetuning_callback.py Outdated Show resolved Hide resolved
@mergify mergify bot removed the has conflicts label Apr 30, 2021
@lexierule lexierule disabled auto-merge April 30, 2021 15:14
@lexierule lexierule merged commit 80b9ca0 into master Apr 30, 2021
@lexierule lexierule deleted the base_finetuning branch April 30, 2021 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
admin Requires admin privileges to merge bug Something isn't working callback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] BaseFinetuning not working with resume_from_checkpoint
6 participants