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.
But no output file :
Here is the kernel :
https://www.kaggle.com/abyaadrafid/fruit-detection-with-fastai-cnn
What am I doing wrong here? Please advise.
Seemant
(Seemant)
May 21, 2019, 11:46am
2
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
Seemant
(Seemant)
May 22, 2019, 4:40am
4
I’m not sure. Probably because of some directory issue.
dipam7
(Dipam)
May 22, 2019, 5:36am
5
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
jasmeet
(Jasmeet KAUR)
July 23, 2019, 10:57pm
7
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.
jasmeet
(Jasmeet KAUR)
July 24, 2019, 4:43am
9
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
eljas1
July 24, 2019, 6:49am
10
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
jasmeet
(Jasmeet KAUR)
July 27, 2019, 2:41am
12
Does not work for me. Maybe something I am doing wrong
Could you provide your kernel link?
Asking just to be sure : did you try replacing the apostrophe?