ValueError: Only instances of keras.Layer
can be added to a Sequential model. Received: <tensorflow_hub.keras_layer.KerasLayer object at 0x7a9a39daf130> (of type <class 'tensorflow_hub.keras_layer.KerasLayer'>)
#662
moatednorth
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sequential api can't handle
hub.KerasLayer
`
Create a Keras Layer using the USE pretrained layer from Kaggle
sentence_encoder_layer = hub.KerasLayer("https://www.kaggle.com/models/google/universal-sentence-encoder/TensorFlow2/universal-sentence-encoder/2",
input_shape=[],
dtype=tf.string,
trainable=False,
name="USE")
Create model using the Sequential API
model_6 = tf.keras.Sequential([
sentence_encoder_layer,
layers.Dense(64, activation="relu"),
layers.Dense(1, activation="sigmoid", name="ouput_layer")
], name="model_6_USE")
`
Beta Was this translation helpful? Give feedback.
All reactions