Lesson 7 in-class chat ✅

Correct and it is so in both cases only assuming there are no other vars that refer to learn.

learn.destroy is almost ready, you can try:

def destroy(self):
    "Free the Learner internals, leaving just an empty shell that consumes no memory"
    attrs = [k for k in self.__dict__.keys() if not k.startswith("__")]
    for a in attrs: delattr(self, a)
    gc.collect()

but it’s not @sgugger approved yet.

You just call:

learn.destroy()

no need for del, None, gc.collect()