Error Deploting on GCP(Fast.ai)

Hi Everyone,
I am getting the following error while trying to upload a Deep Learning model using fast.ai

File "/usr/local/lib/python3.6/site-packages/torch/serialization.py", line 194, in _check_seekable raise_err_msg(["seek", "tell"], e) File "/usr/local/lib/python3.6/site-packages/torch/serialization.py", line 187, in raise_err_msg raise type(e)(msg) AttributeError: 'list' object has no attribute 'seek'. You can only torch.load from a file that is seekable. Please pre-load the data into a buffer like io.BytesIO and try t o load from it instead.
Any idea on how to solve this? I am not sure what else details I have to give. Please do ask me
PS: Should I upload the server.py file?

It looks like you are trying to pass a list to torch.load.
Could you post the code which throws this error and explain a bit, how you’ve saved the model?

Hey!
Here is the code that is being used to deploy the model on Google Cloud Platform - https://github.com/cabhijith/google-app-engine/blob/master/app/server.py

I saved the model using the learn.export() command on fastai, uploaded it to Google Drive and linked it to the above mentioned code. Sorry, I am not a expert so therefore I can’t pin-point the specific line throwing the error:) PLEASE ask for more details.
Thanks for the help!

I’m unfortunately not that familiar with the fastai API, and I guess the error comes from the load_learner call, which calls torch.load internally.

@sgugger might have some insight here.

Thanks! I did ask on the fast.ai platform, but did not get a reply. Thanks!

Are you able to load the export file locally?
If you could create a small reproducible code snippet, I could have a look.
The current code contains a lot of web stuff, which is probably not the source of this error.

I didn’t see your post on the fastai forum, but that’s probably a better place to have this discussion. You are mixing two versions of the library in that setup.py file.

The fact you’re using export_file_name = 'New_P100.pkl' and load_learner suggests you’re on the latest API, but at the same time you use load_learner with a wrong syntax (it takes path, export_file_name and that’s pretty much it since your whole Learner has been serialized) and learn.load (which is the line that calls torch.load behind the scenes with a variable that I don’t see defined in the code (model_file_name).