Storing variables (Google Colabs) for using notebooks again


#1

I have started with this Deep Learning Course using Google Colaboratory and I am very happy with all the features it provides for free. But I have a certain problem. Whenever I close the notebooks, the next time I open them all my variables gets deleted and I need to train my models again using resnet34 and takes 8 mins to do it again. Please suggest me what to do or is this feature possible with Colabs? I want to save the variables in previous cells before executing next one. I have tried mounting the drive.

Please, Please suggest me something.


(George Zhang) #2

Hey chum, look into Learner.export and load_learner here in https://docs.fast.ai/basic_train.html#Deploying-your-model. :wink:

You do need to make sure that the file exported gets stored somewhere, which might take a bit more work with Colab. But once you make sure that, you will be good.


#3

Thanks, it helped a lot. I also noticed that learn.save() also saves the model at one path.:grinning::grinning:


(George Zhang) #4

Not a problem.

Learner.export is usually the easier way to go, because you don’t need to set up the dataset again when loading it.