This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 211
Fix unfreeze strategies with onecyclelr and reduced lr #1329
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ethanwharris
requested review from
Borda,
tchaton,
justusschock,
carmocca and
kaushikb11
as code owners
May 5, 2022 16:33
Codecov Report
@@ Coverage Diff @@
## master #1329 +/- ##
==========================================
+ Coverage 89.84% 91.47% +1.62%
==========================================
Files 287 287
Lines 12894 12900 +6
==========================================
+ Hits 11585 11800 +215
+ Misses 1309 1100 -209
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
krshrimali
approved these changes
May 6, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I agree that we should not change the LR silently. Should we also update the docs here? (in the code sample)
def finetune_function(self, pl_module, current_epoch, optimizer, opt_idx):
# unfreeze any module you want by overriding this function
# When ``current_epoch`` is 5, backbone will start to be trained.
if current_epoch == self._unfreeze_epoch:
self.unfreeze_and_add_param_group(
pl_module.backbone,
optimizer,
)
ethanwharris
added a commit
that referenced
this pull request
May 11, 2022
ethanwharris
added a commit
that referenced
this pull request
May 11, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #1321
Note: This also changes the behaviour to no longer divide the learning rate by 10 when unfreezing. This could be seen as a breaking change, but also as a bug since this behaviour is undocumented and doesn't normally make sense (generally it's a good idea to use a smaller LR after unfreezing for the whole model but this should be handled by an LR scheduler not done silently by us).
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃