Deployment Platform: Render ✅

Hi LessW2020
To use use the file directly
save the pkl file in the app directory in the repository and edit the sever.py file as below.

export_file_url = ‘’
export_file_name = ‘dog_breed_34.pkl’

Cheers mrfabuous1 :smiley::smiley:

1 Like

Unfortunately can’t upload if lareger than 25MB:
“Yowza, that’s a big file. Try again with a file smaller than 25MB.”

I’ve put it on AWS S3 so let me try to pull from that.
for reference: https://b5-100-1.s3-us-west-2.amazonaws.com/export.pkl
which does start a normal download as expected.
Thanks!

HiLessW2020
Too bad :cry::sob::cry::sob:
cheers mrfabulous1 :smiley::smiley:

Hi LessW2020

I think Dropbox allows bigger files!

Cheers mrfabulous1 :smiley::smiley:

I can wget the weights with no issue from aws on my server.
However, using the same URL within server.py still yields the pickle error.
Note I tested wget to the google drive link and you just get a ‘view’ object which internally is as expected Html with first char = < : (the message boards are trying to read the html so I use * below where it’s really <
*!DOCTYPE html> … blah blah

@LessW2020 this may be helpful on the google drive bit:

https://webapps.stackexchange.com/questions/123815/how-to-get-direct-download-url-link-for-directory-in-google-disk

3 Likes

Hi LessW2020

Is this a vision classifier?

Can you open the file and see what is inside it and compare it with the link I posted earlier.

The file I sent can be viewed in Textwrangler which is a unix version of Notepad.

It is my understanding that files with the same extension should behave the same.

Cheers mrfabulous1 :smiley: :smiley:

ok that’s very useful info! Let me post it here in case others need it:

how to create a link from shared file

https://drive.google.com/file/d/FILE_ID/view?usp=sharing

to direct download link

https://drive.google.com/uc?export=download&id=FILE_ID
3 Likes

Hi everyone,
I trained a model using fastai version 1.0.52 - in the render example (https://github.com/render-examples/fastai-v3) version 1.0.51 is used. Is there a way to make this work anyway, because I don’t get my floydhub-kernel to downgrade to 1.0.51 to export the model again. Any recommendations?
Thank you so much in advance.

Hi piaoya hope your having a wonderful day!

As the repo uses docker, there is something you can do. :smiley:

On the platform you trained your model on run “pip list” I use Google Colab so I run “!pip list”

I recommend you test your model in your notebook to make sure it still works and then save the output to a file and save it with your model.

This is because the libraries keep changing sometimes daily, sometimes without a version number change.

Once you have a your list of files, you can change the version numbers of files used in your requirements.txt in your app repository and redeploy it.

If your .pkl file is over 100mb, recently we have noticed it may not download properly from Google.

Please search this thread for posts on pip list if you need to.

Cheers mrfabulous1 :smiley: :smiley:

1 Like

Im With Render but this error

This is my environment :slight_smile:
aiofiles==0.4.0
aiohttp==3.5.4
asyncio==3.4.3
fastai==1.0.54
https://download.pytorch.org/whl/cpu/torch-1.0.0-cp37-cp37m-linux_x86_64.whl
https://download.pytorch.org/whl/cpu/torchvision-0.3.0-cp37-cp37m-linux_x86_64.whl
numpy==1.16.3
pillow~=6.0
python-multipart==0.0.5
starlette==0.12.0
uvicorn==0.7.1

Hi Theopilus.27 hope all is well!

This is my environment :slight_smile:

Is this the same as the environment you trained your model on.

If it isn’t you need to make sure that you have. the same version of libraries in your app as was in your training environment.

The error seems to indicate there is a problem with. the torchvision library however we need to confirm the above has been done before anything else. (See posts on pip list in this thread for further details)

Cheers mrfabulous1 :smiley: :smiley:

Hi, I will try to deploy the generator part of CycleGan. Is there a sample code available for where input and output are both images?

Mh… using pip list I get the information on which version of fastai I am using. (I could also use import fastai; fastai.__version__ to find this out, right?) The most recent version is 1.0.60 but if I train a model on 1.0.60 I get problems with render (example runs with 1.0.52).
Is there a workaround? Downgrading fastai on colab seems not to work. Is there a upgrade from Render to expect?

Hi ozgur hope your well! currently the only code available as starter code is the teddybear classifier https://github.com/render-examples/fastai-v3, it takes an image and returns text. You could amend it to return an image. You could also search the forum to find if someone has deployed something similar and uploaded it to github.com.

Cheers mrfabulous1 :smiley: :smiley:

Thanks @mrfabulous1. I searched but couldn’t find. I will try to change the teddybear example.

1 Like

On the platform you trained your model on run “pip list” I use Google Colab so I run “!pip list”

Once you have a your list of files, you can change the version numbers of files used in your requirements.txt in your app repository and redeploy it.

Hi piaoya hope all is well!
The above two quotes are from my previous post if you read this forum you will see at least 40 people have used this strategy to get their app working. If you follow a few docker.com tutorials you will understand how it works.

your training platform - pip list may look something like this.

fastai==1.0.52
fastai==1.0.54
torch==1.0.0
torchvision==0.3.0
numpy==1.16.3
pillow~=6.0
python-multipart==0.0.5

Just replace these lines in
your app/requirments.txt

fastai==1.0.52
fastai==1.0.54
torch==1.0.0
torchvision==0.3.0
numpy==1.16.3
pillow~=6.0
python-multipart==0.0.5

redeploy it

Once you have done this, you may or may not get another error which we can then fix.
If you don’t get the above right your model will NEVER work.

Hi everyone,
I trained a model using fastai version 1.0.52 - in the render example (https://github.com/render-examples/fastai-v3) version 1.0.51 is used. Is there a way to make this work anyway, because I don’t get my floydhub-kernel to downgrade to 1.0.51 to export the model again. Any recommendations?
Thank you so much in advance.

The above is the answer to this question.

Cheers mrfabulous1 :smiley: :smiley:

1 Like

@mrfabulous1: Thank you so much, now I got it. I thought I needed !pip list in order to train the model with the specific requirements in the github repo example. Thanks to you I now know it’s the other way around. :wink:

1 Like

Hi piaoya hope you had a jolly day! So glad you got it, as I know it can be tricky to deploy your first app on a new system.

Yes the steps are

  1. train your model on any platform and any version of fastai in a notebook.
  2. save your model.
  3. run pip list or pip freeze save this to a file.
  4. now go to any platform that runs the a compatible version of python, docker or a virtual environment.
  5. change your requirements.txt in your repo to match the versions in your training pip list file.
  6. deploy app.

You can now use that repository on any system that uses docker, if it works on render, it will work on my version of docker desktop or other cloud platforms.

Cheers mrfabulous1 :smiley: :smiley:

1 Like

In case anyone needs to deploy CycleGan of course v3 to Render, I created a sample that uses generator of the CycleGan and the api takes image and returns styled image. You can use it as a starter for any style transfer api. I also fixed the requirements for the people who train on Colab. It means you can train on Google Colab and export pkl and use it directly on Render. Current model in my repo is trained to draw sketch of portraits (still tranining though).
You can replace it with your own models just be sure that dropbox link has “?dl=1” in the end to start downloading immediately otherwise you will have unpickle error “_pickle.UnpicklingError: invalid load key, ‘<’.”

Github Repo

Colab CycleGan Sample

Demo on Render: https://sketch-cb9q.onrender.com/

1 Like