fastai / course-v3

The 3rd edition of course.fast.ai
https://course.fast.ai/
Apache License 2.0
4.91k stars 3.57k forks source link

Getting Error "The command '/bin/sh -c python app/server.py' returned a non-zero code: 1" #552

Open BlockchainRev opened 3 years ago

BlockchainRev commented 3 years ago

I don't really know if this is the right place to post this but here goes.

I'm trying to run one of my fastai created models (the google images based one) on Docker (not Kubernetes) and locally on my MacBook Pro Mid 2012 with MacOS Mojave. Link to model is here: github.com/blockchainrev/beanfinder

It reaches the sixth step and breaks with this:

Traceback (most recent call last): File "app/server.py", line 48, in <module> learn = loop.run_until_complete(asyncio.gather(*tasks))[0] File "/usr/local/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete return future.result() File "app/server.py", line 35, in setup_learner learn = load_learner(path, export_file_name) File "/usr/local/lib/python3.7/site-packages/fastai/basic_train.py", line 598, in load_learner state = torch.load(source, map_location='cpu') if defaults.device == torch.device('cpu') else torch.load(source) File "/usr/local/lib/python3.7/site-packages/torch/serialization.py", line 387, in load return _load(f, map_location, pickle_module, **pickle_load_args) File "/usr/local/lib/python3.7/site-packages/torch/serialization.py", line 564, in _load magic_number = pickle_module.load(f, **pickle_load_args) _pickle.UnpicklingError: invalid load key, '\x0a'. The command '/bin/sh -c python app/server.py' returned a non-zero code: 1

Thanks!

ghost commented 3 years ago

My server.py is failing as well, and I am getting the exact same error as above. Tried deploying on Render, local Docker build, AWS. Definitely appears to be a problem with the server.py file.

ghost commented 3 years ago

@BlockchainRev check out my post on the fastai forums to see how I got it working.