How does .export() method work in Google Colab?

Hi everyone,

I have an issue with finding the .pkl file that is created when I export a model using .export()

I basically don’t know how to tell the method where I want the file while I’m using Google Colab, so I can find it and maybe download the file, etc. I’ve read this documentation but I’m looking for something used in Google Colab.

Any help is appreciated!! :slight_smile:

Thanks everyone,

Change learn.path to be "" and try again :slight_smile: (or if not, learn.dls.path). The exported learner is being saved to where the data is being downloaded, you need to change this before exporting

1 Like

Hi @muellerzr ,

Thank you for your response!

Excuse my noob level here, but, how do I do this?

Change learn.path to be "" and try again :slight_smile: (or if not, learn.dls.path )

Your learner has an attribute learn.path and .export() saves the export.pkl at that path. If you check what print(learn.path) returns you should find it. You can also try

!mv {learn.path/'export.pkl'} .

from a notebooks cell, it moves it to the folder your notebook is in.

As mentioned, it’s an attribute of the learner and you can just set it with
learn.path = some_path.

As @muellerzr suggests, you can change it to the empty string, but you have to make it a PosixPath first or .export is going to complain :wink:

learn.path = Path("")

makes all following learn.export() save to the folder your notebook is in :slight_smile:.

2 Likes

That solved my problem! Thank you very much! :grinning:

1 Like