Last active
November 10, 2019 12:34
-
-
Save sobamchan/cad027ad2449c9bc1056b96235d0cc94 to your computer and use it in GitHub Desktop.
pl-bert
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 configure_optimizers(self): | |
param_optimizer = list(self.model.named_parameters()) | |
no_decay = ["bias", "gamma", "beta"] | |
optimizer_grouped_parameters = [ | |
{ | |
"params": [p for n, p in param_optimizer if not any(nd in n for nd in no_decay)], | |
"weight_decay_rate": 0.01 | |
}, | |
{ | |
"params": [p for n, p in param_optimizer if any(nd in n for nd in no_decay)], | |
"weight_decay_rate": 0.0 | |
}, | |
] | |
optimizer = AdamW( | |
optimizer_grouped_parameters, | |
lr=2e-5, | |
) | |
return optimizer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment