-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Add estimated_stepping_batches
property to Trainer
#11599
Conversation
Overall looks clean to me! |
@rohitgr7 Is this waiting on something? |
hey @carmocca ! |
tests/trainer/properties/test_estimated_num_optimization_steps.py
Outdated
Show resolved
Hide resolved
tests/trainer/properties/test_estimated_num_optimization_steps.py
Outdated
Show resolved
Hide resolved
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.
Awesome ! @rohitgr7 Might be worth considering to introduce an estimated_progress
too.
estimated_stepping_batches
property to Trainer
scheduler = torch.optim.lr_scheduler.OneCycleLR( | ||
optimizer, max_lr=1e-3, total_steps=self.trainer.estimated_stepping_batches | ||
) | ||
return [optimizer], [scheduler] |
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.
Hi!
I think this code example may be misleading, bacause (if I get it right) the default scheduler interval is 'epoch', so here the scheduler would only update every epoch (and wouldn't complete the cycle, because the total_steps is set to estimated_stepping_batches, not number of epochs). I tested it in Colab
Should it be like this?
return [optimizer], [{"scheduler": scheduler, "interval": "step"}]
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.
Sounds good to me. Would you like to send a PR updating this example?
What does this PR do?
Fixes #10760
Does your PR introduce any breaking changes? If yes, please list them.
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃
cc @Borda @justusschock @kaushikb11 @awaelchli @ananthsub @ninginthecloud @jjenniferdai @rohitgr7 @akihironitta