Change 1.0.46, re-exporting pkl with v 1.0.46 issue

Hi friends, using the template https://github.com/render-examples/fastai-v3
replaced this
export_file_url = ‘https://www.dropbox.com/s/v6cuuvddq73d1e0/export.pkl?raw=1
classes = [‘black’, ‘grizzly’, ‘teddys’]

with my own file and classes

original all good on render, mine fails with:

Mar 1 12:04:11 PM INFO[0073] RUN python app/server.py
Mar 1 12:04:20 PM Traceback (most recent call last):
File “app/server.py”, line 43, in
learn = loop.run_until_complete(asyncio.gather(*tasks))[0]
File “/usr/local/lib/python3.7/asyncio/base_events.py”, line 584, in run_until_complete
return future.result()
File “app/server.py”, line 31, in setup_learner
learn = load_learner(path, export_file_name)
File “/usr/local/lib/python3.7/site-packages/fastai/basic_train.py”, line 501, in load_learner
state = torch.load(Path(path)/fname, map_location=‘cpu’) if defaults.device == torch.device(‘cpu’) else torch.load(Path(path)/fname)
File “/usr/local/lib/python3.7/site-packages/torch/serialization.py”, line 368, in load
return _load(f, map_location, pickle_module)
File “/usr/local/lib/python3.7/site-packages/torch/serialization.py”, line 542, in _load
result = unpickler.load()
AttributeError: Can’t get attribute ‘ImageList’ on <module ‘fastai.vision.data’ from ‘/usr/local/lib/python3.7/site-packages/fastai/vision/data.py’>
Mar 1 12:04:20 PM error building image: error building stage: waiting for process to exit: exit status 1
Mar 1 12:04:20 PM error: exit status 1

then I found on changes at 1.0.46 (2019-02-25)

load_learner will fail for exported (pickled) models with error “AttributeError: Can’t get attribute ‘ImageItemList’ on module ‘fastai.vision.data’”. You will need to re-export with version 1.0.46 or use 1.0.44

so in Google colab I ran this to update to latest version
!curl https://course.fast.ai/setup/colab | bash

but I keep getting same error, any tips? thank u :wink:

just checked and Im running
Requirement already satisfied: fastai in /usr/local/lib/python3.6/dist-packages (1.0.46)
1.0.46 in google colab, and yet I’m still getting that error mmm,

error refers to Can’t get attribute ‘ImageList’ ,
change log refers to Can’t get attribute ‘ImageItemList’

so there’s something in there mm

1 Like

just fixed it, to make it work I added a
RUN pip install fastai --upgrade
after
RUN pip install --no-cache-dir -r requirements.txt --upgrade

in the dockerfile, and now it works, it uninstalls 45 and installs 46

Did you re-export the model with v1.0.46?

Looks like the pkl file in the export_file_url has not been updated to the latest version, so it’s not working

1 Like

hey Miko, thank you, yes I did, I checked and I exported it with 46, in any case I fixed it by
"adding a
RUN pip install fastai --upgrade
after
RUN pip install --no-cache-dir -r requirements.txt --upgrade

in the dockerfile, and now it works, it uninstalls 45 and installs 46"

2 Likes

Hi Javis

I have a similar problem, when I try to deploy the service manually (I earlier created the web service with the bear image problem, which I subsequently changed). I want to use your fix. But I am not sure what you mean by Docker file. I see Docker (which I chose as environment when I created the web service). But I am not sure how to access the associated Docker file. I am not really from a coding background, so this stuff is all a bit latin to me right now.

Any guidance is deeply appreciated!

Thanks

sorry, I found the docker file and have added the above Run statement you specified. I can now see that it deployed the service. However, when I load an image and click on analyze, it doesn’t work. The error log file shows an error about Relu method not having the attribute Threshold. I also get lot of warnings about changes in all the methods in the source code.

Not sure how to ensure all these libraries are consistent. Any help appreciated!

Thanks

1 Like

friends, I’m deep into part 2 and haven’t looked at this for quite a while (my render project not active anymore also since quite some time) but when I get back to it I will post here any updates :wink: