Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: CosineAnnealingLR is missing #757

Merged
merged 9 commits into from
Nov 15, 2021
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Fix doctest fails with ImportError: cannot import name 'Env' from 'gym' ([#751](https://github.com/PyTorchLightning/lightning-bolts/pull/751))
- Fixed doctest fails with ImportError: cannot import name 'Env' from 'gym' ([#751](https://github.com/PyTorchLightning/lightning-bolts/pull/751))

- Fixed MoCo v2 missing Cosine Annealing learning scheduler ([#757](https://github.com/PyTorchLightning/lightning-bolts/pull/757))

## [0.4.0] - 2021-09-09

Expand Down
6 changes: 5 additions & 1 deletion pl_bolts/models/self_supervised/moco/moco2_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,11 @@ def configure_optimizers(self):
momentum=self.hparams.momentum,
weight_decay=self.hparams.weight_decay,
)
return optimizer
scheduler = torch.optim.lr_scheduler.CosineAnnealingLR(
optimizer,
self.trainer.max_epochs,
)
return [optimizer], [scheduler]

@staticmethod
def add_model_specific_args(parent_parser):
Expand Down