Fix: PriorWD inadvertently sets the weight_decay coefficient for all groups to 0.0 when use_prior_wd flag is False - #5
Open
ykumards wants to merge 2 commits into
Open
Conversation
add an if-flag to class init, this avoids inadvertently setting the group wd coefficient to 0.0 when `use_prior_wd` is set to False
Fix: PriorWD inadvertently sets the weight_decay coefficient for all groups to 0.0 when `use_prior_wd` flag is False
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Probably don't need to merge this, but can serve as a reference for people who fork the repo.
Problem
The PriorWD is wrapper around any optimizer which can be used to perform weight decay by suppressing
||w - w_0||^2instead of||w - 0||^2during training.When
use_prior_wdis set toTrue, the class behaves as expected. When it is set toFalse, the wrapper needs to function as an Identity mapping on the optimizer, but it inadvertently sets the weight decay to0.0.This was fixed by simply adding a conditional statement with use_prior_wd flag during initialization.