Skip to content

Commit

Permalink
fix: adamw default weight decay with torch backend
Browse files Browse the repository at this point in the history
  • Loading branch information
beniz committed Sep 19, 2022
1 parent cd46b2a commit eb0cf83
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/backends/torch/torchsolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ namespace dd
}
else if (_solver_type == "ADAMW")
{
if (_weight_decay == 0.0)
{
this->_logger->warn("Applying default weight decay of 0.01 to "
"ADAMW instead of 0.0");
_weight_decay = 0.01;
}
_optimizer
= std::unique_ptr<torch::optim::Optimizer>(new torch::optim::AdamW(
_params, torch::optim::AdamWOptions(_base_lr)
Expand Down

0 comments on commit eb0cf83

Please sign in to comment.