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

[feature] Add StochasticWeightAveraging (SWA) callback #5640

Merged
merged 69 commits into from
Feb 11, 2021

Conversation

tchaton
Copy link
Contributor

@tchaton tchaton commented Jan 24, 2021

What does this PR do?

This PR adds SWA Callback to Lightning.
https://pytorch.org/blog/pytorch-1.6-now-includes-stochastic-weight-averaging/

Fixes #1894

TODO:

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified
  • Check that target branch and milestone match!

@tchaton tchaton added this to the 1.2 milestone Jan 24, 2021
@tchaton tchaton self-assigned this Jan 24, 2021
pytorch_lightning/callbacks/swa.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/swa.py Show resolved Hide resolved
pytorch_lightning/callbacks/swa.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/swa.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/swa.py Outdated Show resolved Hide resolved
@pep8speaks
Copy link

pep8speaks commented Jan 25, 2021

Hello @tchaton! Thanks for updating this PR.

Line 100:13: W503 line break before binary operator

Comment last updated at 2021-02-10 23:45:21 UTC

@tchaton tchaton marked this pull request as ready for review January 25, 2021 15:18
Copy link
Member

@SkafteNicki SkafteNicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :]

Copy link
Member

@Borda Borda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add typing?

pytorch_lightning/callbacks/swa.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/swa.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/swa.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/swa.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/swa.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/swa.py Outdated Show resolved Hide resolved
pytorch_lightning/callbacks/swa.py Outdated Show resolved Hide resolved
@mergify mergify bot removed the has conflicts label Feb 10, 2021
@mergify mergify bot removed the has conflicts label Feb 10, 2021
@carmocca carmocca self-assigned this Feb 10, 2021
@tchaton tchaton merged commit 7b00894 into release/1.2-dev Feb 11, 2021
@tchaton tchaton deleted the feat/swa branch February 11, 2021 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
callback feature Is an improvement or enhancement ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add stochastic weight averaging