Issues with C3_W4_Lab_3_Saliency on Google Colab

Hello,
I’m having issues with C3_W4_Lab_3_Saliency on colab.

The downgrade to tf 2.15 seemed to work as well as the import of the packages.
When building the model, the following line of code crashes:

model = tf.keras.Sequential([
    hub.KerasLayer('https://tfhub.dev/google/tf2-preview/inception_v3/classification/4'),
    tf.keras.layers.Activation('softmax')
])

And it gives the following error:

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

Could someone have a look on this?

Thanks

Hello, I am not getting any of these errors.

When you run the cells, when you run the first one:

Install packages for compatibility

Make a session restart and then run the other ones. Run->Restart Session

hi @Andreas0815

Are you following these steps, check the pinned comment

Regards
DP

Hello,

thanks for your support. It was my mistake. I think I restarted the whole colab instead of the whole session or something similar happened. It works now.

Andreas

2 Likes