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
{
"name": "ValueError",
"message": "Only instances of `keras.Layer` can be added to a Sequential model. Received: <tensorflow_hub.keras_layer.KerasLayer object at 0x75776b09fc10> (of type <class 'tensorflow_hub.keras_layer.KerasLayer'>)",
"stack": "---------------------------------------------------------------------------ValueError Traceback (most recent call last)Cell In[123], line 2 1 model_6 = tf.keras.Sequential()----> 2 model_6.add(sentence_encoder_layer) 3 model_6.add(layers.Dense(64, activation=\"relu\")) 4 model_6.add(layers.Dense(1, activation=\"sigmoid\"))File ~/.python/current/lib/python3.10/site-packages/keras/src/models/sequential.py:95, in Sequential.add(self, layer, rebuild) 93 layer = origin_layer 94 if not isinstance(layer, Layer):---> 95 raise ValueError( 96 \"Only instances of `keras.Layer` can be \" 97 f\"added to a Sequential model. Received: {layer} \" 98 f\"(of type {type(layer)})\" 99 ) 100 if not self._is_layer_name_unique(layer): 101 raise ValueError( 102 \"All layers added to a Sequential model \" 103 f\"should have unique names. Name '{layer.name}' is already \" 104 \"the name of a layer in this model. Update the `name` argument \" 105 \"to pass a unique name.\" 106 )ValueError: Only instances of `keras.Layer` can be added to a Sequential model. Received: <tensorflow_hub.keras_layer.KerasLayer object at 0x75776b09fc10> (of type <class 'tensorflow_hub.keras_layer.KerasLayer'>)"
}
What happened?
I'm trying to create a model using a TensorFlow Sequential API, but I've the error. The model is : https://tfhub.dev/google/universal-sentence-encoder/4
Relevant code
Relevant log output
tensorflow_hub Version
0.16.1
TensorFlow Version
2.17.0
Other libraries
tensorflow==2.17.0
tensorflow_hub==0.16.1
keras==3.4.1
Python Version
3.x
OS
Linux
The text was updated successfully, but these errors were encountered: