Can't find output file in committed kaggle kernel

Hi, I wanted to get my models .pkl file using learner.export. But there is no “Output” section on left-hand side of my committed kaggle kernel.

image

But no output file :
image

Here is the kernel :
https://www.kaggle.com/abyaadrafid/fruit-detection-with-fastai-cnn

What am I doing wrong here? Please advise.

You can directly download the pickle file without committing the code in kaggle.

learner50.export(‘fruitsmodel.pkl’)

from IPython.display import FileLink
FileLink(‘fruitsmodel.pkl’)

This will create a download link for you, from which you can download your file.

1 Like

It worked. Thank you so much Seemant.
I had to use absolute path for FileLink though, otherwise the file was not being generated.

Also do you have any idea why output file might not appear after commit? For future reference of course :smiley:

I’m not sure. Probably because of some directory issue.

hey can you try learn.export("/kaggle/working/fruitsmodel.pkl"). That might work

2 Likes

It worked.
So the issue was with relative/absolute path.
Thanks, Dipam.

1 Like

I am trying to use above lines to download file, however I am getting this error

default backend - 404

Please let me know if I am doing something wrong.

Hi, @jasmeet
Try using absolute path in the FileLink.
If your directory is read-only or if you are in a different directory than your model, this method might not work.

This error occurs if FileLink fails.

Hi @abyaadrafid,

I am using

FileLink(’/kaggle/working/stage-1.pkl’)

is it absolute path? Also, I am in the working directory and this file exists in the working directory. Can you please help me?

the link that opens is - https://www.kaggleusercontent.com/kaggle/working/stage-1.pkl
and the error I am getting is :

default backend - 404

Remember that Kaggle has a ‘read-only’ restriction in the input folder except for submission files. In most cases you need to create another folder in the root and save your files there.

Try this :

cd /kaggle/working

from IPython.display import FileLink
FileLink('fruitsmodel.pkl')

This is working for me.

1 Like

Does not work for me. Maybe something I am doing wrong :frowning:

Could you provide your kernel link?
Asking just to be sure : did you try replacing the apostrophe?