-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Pass lr_scheduler
to Accelerator.prepare
#301
Conversation
The documentation is not available anymore as the PR was closed or merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on this! Left a few suggestions for documentation consistency and a copy/paste victim 😉
for opt in self._optimizers: | ||
if getattr(scheduler, "optimizer", None) == opt.optimizer: | ||
optimizer = opt | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clever! I had wondered how you'd do this 😄
Co-authored-by: Zachary Mueller <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As said offline, LGTM!
This PR adds support for passing the learning rate scheduler to
Accelerator.prepare
. This only concerns learning rate schedulers that are called at each optimizer step, not schedulers that are called at the end of each epoch.Why?
There are three reasons motivating this change: