Deployment Platform: Render ✅

have found a way to go about the application, mine is now working. how i go about it:

  1. 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.
  2. since the teddy bear app is working, i followed the direction from the top post by @aschiller here . 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.
  3. then i copied the generated link to the teddy bear 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
  4. 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

Hooray :laughing::laughing::laughing::laughing:I have now got my model working on Render.

I train my models on Google Colab as I do not have a GPU at the present and my mac takes to long sometimes.

When I forked the GitHub teddy bear example I mentioned in my previous post I had an error.

My Solution
l looked in the requirements.txt and changed the pytorch version to the version in my Google Colab notebook.

I got a different error.

I ran !pip list on my Google Colab notebook and changed all the libraries in the requirements.txt to the same version as on my Colab notebook.

This solved the problem.

However even though the errors were gone in the Render terminal the app was stuck in the analyzing state.

I switched from Safari to Chrome and it works fine now.

It seems that the .pkl must match the libraries of the system the .pkl was created on, so in this case the requirements.txt must be amended.

Hope this helps.


hi, I have this error during deployment. I can not figure it out.

i already edit the requirements.txt to match my environment.

I attached part of my model in case , it is required.

thanks a lot.

If ur export.pkl file is to large, then u have to generate Google drive API token with the shared export.pkl API.

I’ve got my first model trained on Colab working on Render too:

Except the image cleaner widget that doesn’t work in Colab, all the rest went smoothly, including the deployment on, 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.


1 Like

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.

mrfabulous1 :grinning:

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 ?

Any clue why this line in gives the above attached error?

learn = loop.run_until_complete(asyncio.gather(*tasks))[0]

Replace the former export.pkl URL I’m the with the Google link u generate

1 Like

What is the error?

I will try it now . the error is attached above.

Thank you :slightly_smiling_face: , it works great after replacing the export.pkl shared the link with Google generated a direct link in file

1 Like

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.

(fastai) bash-3.2$ cat requirements.txt

When I run the command below the app starts okay.
(fastai) bash-3.2$ python app/ serve
INFO: Started server process [87815]
INFO: Uvicorn running on (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/”, line 371, in run_asgi
asgi = app(self.scope)
TypeError: call() missing 2 required positional arguments: ‘receive’ and ‘send’
INFO: (‘’, 54249) - “GET / HTTP/1.1” 500

Can anyone suggest a solution or other things I can check?

Thanks in advance mrfabulous1 :smiley:

Yippee :smiley::smiley::smiley::smiley: finally got it working had to use a library version not currently supported by Anaconda.

I encountered a very strange behaviour with fastai when trying to deploy my model.

When on tries to predict the image I uploaded I get following error:

File "app/", line 65, in analyze
  prediction = learn.predict(img)[0]
File "/usr/local/lib/python3.7/site-packages/fastai/", 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/", 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/", 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…

Hi Derek,

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‘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.

let me know if you have any questions

1 Like

Hi I’m using google colab, I’ve forked in the github and created an account in render. What should i do next?

Hi, i am using google colab,
i ran the learn.export() command now how do i upload the export.pkl file to google drive?

Hi Ajaykumaar are you using this link as all the instructions are there, it is quite clear.

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.

Hope this helps.

mrfabulous1. :smiley::smiley:

1 Like