Created
January 21, 2022 09:27
-
-
Save lewtun/d01b7148d8a4bed0b2ebdf0386d89952 to your computer and use it in GitHub Desktop.
Correction to page 334
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
def get_grouped_params(model, no_decay=["bias", "LayerNorm.weight"]): | |
params_with_wd, params_without_wd = [], [] | |
for n, p in model.named_parameters(): | |
if any(nd in n for nd in no_decay): | |
params_without_wd.append(p) | |
else: | |
params_with_wd.append(p) | |
return [{'params': params_with_wd, 'weight_decay': args.weight_decay}, | |
{'params': params_without_wd, 'weight_decay': 0.0}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment