There are two issues with the labs.
First issue is need for paid Colab plan. Recommended way to run the week 4 labs for " Custom and Distributed Training with TensorFlow" seem to be by opening them in Colab and using “GPU” or “TPU” runtime type. But trying to connect to GPU or TPU instance often results in message like …
Cannot connect to GPU backend
You cannot currently connect to a GPU due to usage limits in Colab. [Learn more](https://research.google.com/colaboratory/faq.html#usage-limits)
To get more access to GPUs, consider purchasing Colab compute units with [Pay As You Go](https://colab.research.google.com/signup?utm_source=dialog&utm_medium=link&utm_campaign=gpu_assignment_failure).
… even when all other sessions have been terminated. If a paid Colab plan is required in order to take advantage of all the content in the course, that should be advertised prominently upfront so that the cost of the paid Colab plan can be considered before registering for the course.
For example, I couldn’t get Lab 3 to run in Colab for this reason. And it wouldn’t run in Coursera instance because of the lack of TPU.
When running the other labs on Colab, even GPU instances weren’t always available.
And the second issue is that it seems maybe some or all of the code in the labs are outdated. For example, Lab 4, upon running the last code block with one_strategy.scope(): model = build_and_compile_model()
in Colab GPU instance, the following error message is output:
Building model with https://tfhub.dev/tensorflow/resnet_50/feature_vector/1
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-10-6d16d4fab908> in <cell line: 0>()
1 # build and compile under the strategy scope
2 with one_strategy.scope():
----> 3 model = build_and_compile_model()
2 frames
/usr/local/lib/python3.11/dist-packages/keras/src/models/sequential.py in add(self, layer, rebuild)
95 layer = origin_layer
96 if not isinstance(layer, Layer):
---> 97 raise ValueError(
98 "Only instances of `keras.Layer` can be "
99 f"added to a Sequential model. Received: {layer} "
ValueError: Only instances of `keras.Layer` can be added to a Sequential model. Received: <tensorflow_hub.keras_layer.KerasLayer object at 0x79ba9bd19990> (of type <class 'tensorflow_hub.keras_layer.KerasLayer'>)