have found a way to go about the application, mine is now working. how i go about it:
i fork the fastai-v3-render app repo for teddy bear again, connect it to the render web service and deploy
to check if is working. it actually work.
since the teddy bear app is working, i followed the direction from the top post by @aschillerhere . for file whose mb is > 25 mb might be seen as virus, so i generate a google cloud api with the shared link of the export.pkl. follow the step here.
then i copied the generated link to the teddy bear server.py to replace the former export.pkl and change the class name. and deploy on render, it load properly, and it gave error that the nn.Module is different
so i changed the fastai verion to my own version 1.0.54 and torch to 1.0.0 and torch vision to torchvision=0.2.1.
5)then it was deployed again and it work perfectly
Except the image cleaner widget that doesn’t work in Colab, all the rest went smoothly, including the deployment on onrender.com, just by following the instructions of this thread (thanks @anurag ) and without changing any library. I’m using Chrome under Windows 7 as IE doesn’t work properly.
The cleaning widget is not supported on Colab currently as far as I am aware. I believe its because Google have disabled widgets for security purposes. Glad you got your app working.
I already did generate google drive API token and test my shared link of export.pkl on the browser , it is public. It is 84MB.
May I ask what shall I do with the google direct link (after use export shared link then add my google cloud key-> i got a google direct link ) , Is it for testing only ?
Siuation
I have successfully loaded an app on render.
I now need to run the render app locally.
I upgraded my fastai installation via anaconda 2 days ago.
I ran !pip list in my jupyter notebook and changed my requirements.txt to match the
jupyter notebook installed versions.
Problem
When I run the command below the app starts okay.
(fastai) bash-3.2$ python app/server.py serve
INFO: Started server process [87815]
INFO: Uvicorn running on http://0.0.0.0:5042 (Press CTRL+C to quit)
**When I go to the browser it shows **
Internal server error
Error displayed in terminal/console
ERROR: Exception in ASGI application
Traceback (most recent call last):
File “/anaconda/envs/fastai/lib/python3.6/site-packages/uvicorn/protocols/http/httptools_impl.py”, line 371, in run_asgi
asgi = app(self.scope)
TypeError: call() missing 2 required positional arguments: ‘receive’ and ‘send’
INFO: (‘127.0.0.1’, 54249) - “GET / HTTP/1.1” 500
Help!
Can anyone suggest a solution or other things I can check?
I encountered a very strange behaviour with fastai when trying to deploy my model.
When server.py on render.com tries to predict the image I uploaded I get following error:
File "app/server.py", line 65, in analyze
prediction = learn.predict(img)[0]
File "/usr/local/lib/python3.7/site-packages/fastai/basic_train.py", line 367, in predict
raw_pred,x = grab_idx(res,0,batch_first=batch_first),batch[0]
File "/usr/local/lib/python3.7/site-packages/fastai/torch_core.py", line 325, in grab_idx
if batch_first: return ([o[i].cpu() for o in x] if is_listy(x) else x[i].cpu())
File "/usr/local/lib/python3.7/site-packages/fastai/torch_core.py", line 325, in <listcomp>
if batch_first: return ([o[i].cpu() for o in x] if is_listy(x) else x[i].cpu())
AttributeError: 'list' object has no attribute 'cpu'
Why does it throw this error? Predicting images in Jupyter Notebook works without problems…
Can you let me know how you exported PKL file? My model is exporting PTH file only.
Did you rename it to .PKL or is there something else needs to be done?
Any inputs will be helpful.
Sure thing so you want to use learn.export(‘my_file_name.pkl’) rather than using learn.save(‘my_file_name’)
The .save method is used for saving to .pth, I believe that this is just used for saving and loading your model while working on it and .pkl is a bit lighter so used for moving around to different systems.
I have now used this exact document to build 5 image classifiers.
If you read the above document it tells you in this link ( Google Drive: Use this link generator what to do once you have uploaded the export.pkl to your google drive.