-
Notifications
You must be signed in to change notification settings - Fork 967
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
Schedule free optimizer support #2631
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Some general observations off the nlp_example: Seems to converge faster, here is our baseline vs the new example, read as (accuracy, f1 score):
|
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.
Thank you @muellerzr for adding train
and eval
methods required for scheduler free optimizers! 🚀
By the way, since ScheduleFree doesn't require schedule, do we need to create another noSchedule class specifically? |
Nope, just don't pass a scheduler to Not a very complicated implementation needed here |
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.
LGTM, thanks for adding this feature and a script to test it. Btw. any idea what would happen if a user forgets to call optimizer.eval()
?
I have a comment suggesting to add a training
property too, but no blocker.
Sets the optimizer to "eval" mode. Useful for optimizers like `schedule_free` | ||
""" | ||
return self.optimizer.eval() | ||
|
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.
How about adding a @property
for self.optimizer.training
too? I don't think we also need a setter for this, as train()
and eval()
should be enough.
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.
That gets to be optimizer-specific, so not a fan of it unless its downstreamed, as they currently don't have that: https://github.com/facebookresearch/schedule_free/blob/main/schedulefree/adamw_schedulefree.py#L86
(Otherwise I'd agree, yes that's a good idea)
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.
Ah I see, good point.
What does this PR do?
Facebook recently released an optimizer that doesn't require an LR scheduler. This PR adds support in by enabling optimizers to call
.train()
and.eval()
as a passthrough.See https://github.com/facebookresearch/schedule_free/tree/main
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@BenjaminBossan