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
[TF2.0] Not JSON Serializable error wasn thrown when using tf.keras.activations operators in keras model. #28010
Comments
I have slightly edited your code to be consistent with import tensorflow as tf
#from tensorflow import keras
#from tensorflow.keras import layers
inputs = tf.keras.Input(shape=(784,), name='digits')
#x = tf.keras.layers.Activation('relu')(inputs)
x = tf.keras.activations.relu(inputs)
outputs = tf.keras.layers.Dense(10, activation='softmax', name='predictions')(x)
model = tf.keras.Model(inputs=inputs, outputs=outputs, name='3_layer_mlp')
model.summary()
model.save('path_to_my_model.h5') Output: ---> 13 model.save('path_to_my_model.h5')
TypeError: ('Not JSON Serializable:', b'\n\x06Relu_8\x12\x04Relu\x1a\tdigits_25*\x07\n\x01T\x12\x020\x01') |
I got the same error, but with:
returns:
|
Additionally, using "+" operator instead of tf.keras.layers.Add makes this issue same. |
I am facing the same issue, any suggestions or solutions for work around for now ?? |
I am having the same issue when using tf.concat in an otherwise keras-only model (can't use keras Concatenations due to issue #30355 ). Only work around I have found so far is to use model.save_weights(). When loading, you need to redefine the model and then use model.load_weights() |
Having same issue with TF 1.14 and Python 3.6 with
Thus |
Same problem here. Is this being worked on?
TensorFlow 2.0.0-b1 |
Was able to repro and have a fix out for this, should be in in a day or two |
Hello, |
Should be fixed: 7cc180f |
Closing this issue since its fixed in latest tf nightly build '2.0.0-dev20190802' |
Had the problem |
@yassinetb Did you have any solution for the error "TypeError: ('Not JSON Serializable:', tf.float32)" from setting save_weights_only=False |
I am facing the same issue using tf.keras.callbacks.ModelCheckpoint . Any solution ? |
System information
Describe the current behavior
When I used tf.keras.activations operators in my keras model, serialization of model was failed due to Not JSON Serializable error.
Describe the expected behavior
It should be serialized without any error.
Code to reproduce the issue
If you changed from Activation() to relu, it failed to serialize.
The text was updated successfully, but these errors were encountered: