C3W3 ungraded Colab out of memory error

C3W3’s ungraded colab notebook talking about Knowledge Distillation will run out of T4 memory while training the teacher model, how to fix it?
Web link: Coursera | Online Courses & Credentials From Top Educators. Join for Free | Coursera

Thanks for bringing this up. The kernel crashes because RAM of only 12.7 GB is allocated on my free instance. It has nothing to do with GPU RAM. So, please go ahead and make the following changes:

  1. Change shuffle buffer size to a smaller value like: train_examples.shuffle(100)
  2. Run del student_scratch once you’re done running that cell. This ensures that the scratch model is discarded to free some memory.
student_scratch_history = ...
student_scratch_acc = student_scratch.evaluate(test_batches, return_dict=True).get("sparse_categorical_accuracy")
del student_scratch

The staff have been notified about this as well.