Skip to content
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

value error in keras layer #100

Open
soffiyahabass1 opened this issue Aug 8, 2024 · 1 comment
Open

value error in keras layer #100

soffiyahabass1 opened this issue Aug 8, 2024 · 1 comment

Comments

@soffiyahabass1
Copy link

ValueError: Only instances of keras.Layer can be added to a Sequential model. Received: <tensorflow_hub.keras_layer.KerasLayer object at 0x7d4e252400a0> (of type <class 'tensorflow_hub.keras_layer.KerasLayer'>)

It showing this error for this code

Setup the model layers

model = tf.keras.Sequential([
hub.KerasLayer(MODEL_URL),

Wrap hub.KerasLayer in a Lambda layer

tf.keras.layers.Dense(units=OUTPUT_SHAPE, 
                      activation="softmax")  # Layer 2 (output layer)

])

@ceodaniyal
Copy link

downgrade TensorFlow to version 2.15.

You can easily do this by running:
𝘱𝘺𝘵𝘩𝘰𝘯
!𝐩𝐢𝐩 𝐢𝐧𝐬𝐭𝐚𝐥𝐥 𝐭𝐞𝐧𝐬𝐨𝐫𝐟𝐥𝐨𝐰==𝟐.𝟏𝟓

Here is the detail post

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants