-
Notifications
You must be signed in to change notification settings - Fork 615
Adding TimeStopping to tfa.callback #757
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
Conversation
Check out this pull request on You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB. |
@seanpmorgan when you have a chance may you review this PR? Thank you so much for your time! |
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.
Looks very good. Please see comments
Args: | ||
seconds: maximum amount of time before stopping. | ||
Defaults to 86400 (1 day). | ||
verbose: verbosity mode. Defaults to 0. |
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.
Is there a reason for using an int here instead of a boolean? Doesn't seem like varying verbosity values will make any difference, so better to prevent that confusion
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 use int here for consistency with EarlyStopping Callback.
https://github.com/tensorflow/tensorflow/blob/r2.0/tensorflow/python/keras/callbacks.py#L1134-L1251
And I would assume they also use int instead of just boolean is so that it is consistent with other places that has verbose as a parameter. This is my reasoning (for consistency), but if you feel like changing to boolean is better let me know! Thanks for the feedback!
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. Still feels a little intuitive, but I agree better to stay with the convention.
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.
Small lint fix needed:
tensorflow_addons/callbacks/time_stopping.py:53: [C0301(line-too-long), ] Line too long (80/79)
ops, got it will fix! |
fixed! |
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 again for the contribution!
This PR adds TimeStopping to tfa.callback. Similar to EarlyStopping but stops the training when a specified amount of time has passed since the start of the training.
This may be useful for people who want to train a model for a certain amount of time. Personally, sometimes I would want to train models for a certain amount of time (and there are codes after training ends so CTRL+C is not ideal) and I often find myself using pen and pencil to calculate how many epochs I would want to run. I hope people may find this useful as well.
Relevant Issues:
#750
keras-team/keras#1625
keras-team/keras-contrib#87
Thank you so much for your time!