Fix bug in build_optimizer
Summary:
The SGD optimizer should always use `cfg.SOLVER.BASE_LR` learning rate.
If the last named param is a bias term and `cfg.SOLVER.BIAS_LR_FACTOR != 1.0`, then the lr will be set to an incorrect multiple.
@@ -28,7 +28,7 @@ def build_optimizer(cfg: CfgNode, model: torch.nn.Module) -> torch.optim.Optimiz
weight_decay = cfg.SOLVER.WEIGHT_DECAY_BIAS
params += [{"params": [value], "lr": lr, "weight_decay": weight_decay}]
- optimizer = torch.optim.SGD(params, lr, momentum=cfg.SOLVER.MOMENTUM)
+ optimizer = torch.optim.SGD(params, cfg.SOLVER.BASE_LR, momentum=cfg.SOLVER.MOMENTUM)
return optimizer
