-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
Let EarlyStoppingCallback
not require load_best_model_at_end
#35101
Conversation
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 !
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. |
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.
This one might need a real core maintainer cc @ArthurZucker @LysandreJik! The code looks good, but is there a risk of user confusion if they use EarlyStopping but actually get a checkpoint later than the best one with significantly worse metrics? I think I'd find that behaviour quite surprising.
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.
Thanks for the change, from my point of view it's much more intuitive that I can use early stopping without loading the best model at the end. The checkpoint is still there and I can decide to load it if I want to.
but is there a risk of user confusion if they use EarlyStopping but actually get a checkpoint later than the best one with significantly worse metrics? I think I'd find that behaviour quite surprising.
How about just giving a warning? So use the old check but don't error out but only warn. I'm not necessarily happy about adding more warnings, but if users have come to rely on this error to remind them to enable load_best_model_at_the_end
, getting a warning could be a good compromise.
Hmm, I'm negative on warnings in general, but maybe a single warning at the end of training might be understandable here, given the potential performance damage if users want the best checkpoint but get the one after n epochs of metrics getting worse. |
@muellerzr What is your opinion on giving a warning? |
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.
I have no strong opinion, the less warning the better as long as something is properly documented! 🤗
Let's not forget about this PR, not a lot missing for it to be merged. |
I'll add in the warning now :) |
What does this PR do?
This PR tweaks
EarlyStoppingCallback
to still require a metric, but doesn't needload_best_model_at_end
. Doing so lets users still use it, but optionally doesn't require them to load it back in at the end of training if they don't want to.Fixes # (issue)
Request of @BenjaminBossan
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.
@Rocketknight1 @SunMarc