I’m having difficulty importing data from Tensorflow Hub.
The data comes from a tf.dataset that contains a pd.Dataframe and images aggregated in the tf.dataset. When I use it with cropnet it says:
Only instances of keras.Layer can be added to a Sequential model. Received: <tensorflow_hub.keras_layer.KerasLayer object at 0x7fadc741d550> (of type <class ‘tensorflow_hub.keras_layer.KerasLayer’>)
A KerasTensor is symbolic: it’s a placeholder for a shape an a dtype. It doesn’t have any actual numerical value. You cannot convert it to a NumPy array
Hi @Andre_Galhardo, Thank you for reporting this bug. while reproducing the issue we have also observed the same. As an alternative i recommend you to use tf.keras which does not provide any error.
model = tf.keras.Sequential([encoder_layer, tf.keras.layers.Dense(1,activation=“sigmoid”)],
name=“model_pretrained”)
ValueError: Only instances of keras.Layer can be added to a Sequential model. Received: <tensorflow_hub.keras_layer.KerasLayer object at 0x14f2a7650> (of type <class ‘tensorflow_hub.keras_layer.KerasLayer’>)
Hi @rtax, I have tried to load the universal sentence encoder from tf_hub using tensorflow 2.15.1 and keras 2.15.0 in colab and did not face any error. could you please try with the above mentioned versions and let us know the execution status. Please refer to this gist for working code example. Thank You.