-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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 typing to some callback classes #16692
📝 Add typing to some callback classes #16692
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.
Thanks for the PR! First, we'll discuss with the team to determine whether we need/want explicit types throughout the codebase.
keras/callbacks.py
Outdated
save_freq: Union[int, str] = "epoch", | ||
options: Union[ | ||
tf.train.CheckpointOptions, tf.saved_model.SaveOptions, None | ||
] = None, |
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.
In general we should avoid explicit types when the expect type is a custom class, like in the above case. It creates significant tech debt and maintenance burden going forward.
After extensive discussions, this is what we will do going forward:
Please update the PR accordingly and format the code using |
Could we make an exception for the public api? I get that it's a lot of work to use custom types everywhere in the codebase and to maintain them, but for the public API, it has a direct benefit to the user through Mypy and IDEs, so it might outweight the cost of maintenance Furthermore, those public API type hints could be in theory be read and displayed in the documentation, giving us even more incentive to do it This move would be in line with the first of the keras-team values: We have empathy for our users |
This is our policy at this time. We may revise it in the future. |
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 updates!
Provides an exemple to keras-team/tf-keras#555