Re-training a saved model

I have built a classifier, and have saved it (using the export function, as well as getting the .pth file to the classifier). I would like to now load this trained model and train it further with new data samples. How would I go about this?

assuming you’ve already created the learner (moreover didn’t ‘uncreate’ it by restarting kernel etc), this does the trick provided you’re in the correct working dir.

learner.load(‘the model you saved’)

remember to also recreate a new data bunch with your new samples.

If this doesn’t help… which platform are you using? Eg Kaggle exports and saves can be ephemeral ( even in session ! )

data = create your data bunch here with new data
learn = load_learner(path that contains export.pkl)


I downloaded the .pth file of my trained model, however when I returned to training the model (I am working on colab and uploaded the file to /content/models and had created the learner before ),I tried loading the state to the learner using-


I was given the error–

unexpected EOF. The file might be corrupted.

Do we need to download some extra files for loading the state of the learner?Also, what does export do?

I have encountered a similar error, specifically with colab. When I download my export.pkl, and then returned later and uploaded it, the export.pkl file is actually pretty large (82mb) and takes a bit to load. If I try to load it in using load_learner() before it is fully done uploading to colab, it will try to take that part of the file and create a model, which obviously it will fail at. If I wait until it is done uploading into the contents, and try again, everything works fine.

You used a different method of uploading, but maybe its related.

I later found out that the whole .pth file was not being downloaded, due to which I encountered the error. I then uploaded the file to drive and used it from there, which worked absolutely fine.
Same problem, solved now.

Hi, I’m looking for a solution similar to the question you have asked. Can you elaborate on the steps you have followed, as I am a complete beginner to fastai

@dreambeats After i am getting this error:AttributeError: ‘TabularList’ object has no attribute ‘train_dl’.

You saved my life! Been looking for a solution since 2 hours! You solved it. Thank you so much.

Is this for v1 or v2?. I am currently doing it in v2 and I didnt finf property.