C2W4 optional task: Error in Collab

Hi there,
I followed the instructions provided in the course to save and upload the script to collab for faster computing. When I run it, I am encountering this error during" Instantiate the model, optimizer, and checkpoints":

OSError Traceback (most recent call last)

1 # model and optimizer must be created under strategy.scope.
2 with strategy.scope():
----> 3 model = ResNetModel(classes=num_classes)
4 optimizer = tf.keras.optimizers.Adam()
5 checkpoint = tf.train.Checkpoint(optimizer=optimizer, model=model)

6 frames

/usr/local/lib/python3.8/dist-packages/tensorflow_hub/resolver.py in call(self, handle)
494 def call(self, handle):
495 if not tf.compat.v1.gfile.Exists(handle):
→ 496 raise IOError("s does not exist." handle)
497 return handle

OSError: data/resnet_50_feature_vector does not exist.

Any help on this would be great. Thanks.

1 Like

Maybe you are forgetting to run prior cells!

unfortunately i get the same error. i did run all the prior cells and within juypter, i dont get the error

I just ran the notebook and it worked for me. You must be doing something wrong in a cell. You should look carefully in the cells that you are supposed to write code and make sure you are not modifying the code in the others.

I was having the same error. The problem seems to be with the MODULE_HANDLE variable, which tells the tensorflow hub where to download the model. The notebook from coursera uses hub version 0.9.0 and the one from colab uses 0.13.0(as off when I am posting this), so this may be why it works in one place but not the other.

You can change it to MODULE_HANDLE='https://tfhub.dev/tensorflow/resnet_50/feature_vector/1' in colab, which is the address I found at the hub page: TensorFlow Hub

It worked for me.

1 Like

Nice!! Thanks, @hmeretti, for tracking this down!

I’ll let the developers know so they update the assignment - which for now might just mean adding one more step to the instructions for running in Colab - to change the MODULE_HANDLE the the address you found on Tensorflow hub. Even better if they can find something that will work in both environments, but that may need to wait until Coursera updates their version of tensorflow_hub.

Hi everyone! The error occurs in Colab because the default MODULE_HANDLE in the notebook points to a path in your Coursera workspace. It is saved locally there so you won’t have to download every time when running the notebook in that platform. For Colab, you do have to download it so you need to modify the MODULE_HANDLE and point it to TFHub as Henrique pointed out. Additional instructions are now in the notebook to explain the error. Thank you for pointing this out!