You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 20.04 and macOS
TensorFlow installed from (source or binary): binary
TensorFlow version (use command below): 2.6.0 and nightly
Python version: 3.7, 3.8 and 3.9
Describe the current behavior
When implementing custom prediction logic for Keras models using predict_step as explained here, saving and restoring the Keras model with the saved model format ignores the custom prediction logic. Unfortunately the code silently fails and doesn't inform the user that this is not supported, which could lead to detrimental bugs.
The issue is explained in detail with a minimal example in this colab notebook.
as described here.
But I feel the current behaviour breaks with user expectations since the saved model format is now the default saving format but doesn't support all of the features and might silently fail resulting in unexpected behaviour.
This makes it necessary for users to break the abstraction and start using low level TF APIs instead, which I think doesn't fit well with the progressive disclosure of complexity that Keras tends to strive for.
Describe the expected behavior
Keras models should preserve custom predict_step logic when saving and restoring models.
System information
Describe the current behavior
When implementing custom prediction logic for Keras models using
predict_step
as explained here, saving and restoring the Keras model with the saved model format ignores the custom prediction logic. Unfortunately the code silently fails and doesn't inform the user that this is not supported, which could lead to detrimental bugs.The issue is explained in detail with a minimal example in this colab notebook.
I know I can save a custom serving function using
as described here.
But I feel the current behaviour breaks with user expectations since the saved model format is now the default saving format but doesn't support all of the features and might silently fail resulting in unexpected behaviour.
This makes it necessary for users to break the abstraction and start using low level TF APIs instead, which I think doesn't fit well with the progressive disclosure of complexity that Keras tends to strive for.
Describe the expected behavior
Keras models should preserve custom
predict_step
logic when saving and restoring models.Standalone code to reproduce the issue
See this notebook for more information.
Also checkout tensorflow/tensorflow#48149 which was originally posted to TF before the move to keras-team/keras.
The text was updated successfully, but these errors were encountered: