Deployment Platform: Render ✅


(Dan Eiref) #104

Hi @anurag I wanted to give render a try, but when I click on https://dashboard.render.com/register?i=fastai-v3 all it gives me is a blank page, and when I try to sign up at render.com it tells me I’ll be notified later about when I can sign up. Thoughts? Thanks.


(building render.com) #105

I just sent you an invite. Try hard-refreshing the dashboard or open it in a different browser?


(Dan Eiref) #106

Thanks! Appears to be a FireFox problem. I should have checked that first.


(Bob Vo) #107

I successfully deployed the demo code by following the instructions on fastai official course website.

The experience was smooth and enjoying. What a great platform! Congrats Anurag!


(Bradley Brown) #108

I am getting the error

AttributeError: Can’t get attribute ‘ImageItemList’ on <module ‘fastai.vision.data’ from ‘/anaconda3/envs/fastai-env/lib/python3.7/site-packages/fastai/vision/data.py’>

when trying to locally run a server.
I have tried changing the requirements txt to the specific version listed but nothing has changed.

=== Software ===
python : 3.7.2
fastai : 1.0.46
fastprogress : 0.1.20
torch : 1.0.1.post2
torch cuda : None / is Not available

=== Hardware ===
No GPUs available

=== Environment ===
platform : Darwin-17.7.0-x86_64-i386-64bit
conda env : fastai-env
python : /anaconda3/envs/fastai-env/bin/python
sys.path : /Users/bradleybrown/Desktop/fastai/webapp/fastai-v3
/anaconda3/envs/fastai-env/lib/python37.zip
/anaconda3/envs/fastai-env/lib/python3.7
/anaconda3/envs/fastai-env/lib/python3.7/lib-dynload
/anaconda3/envs/fastai-env/lib/python3.7/site-packages
no supported gpus found on this system


(Yijin) #109

Hi Bradley,

This was mentioned a few posts before your post, please see here. If your requirements.txt is getting the latest fastai 1.0.46, you need to make sure you exported the pkl file with fastai 1.0.46 too. If your pkl file was exported with an older fastai version (eg 1.0.44), then change the requirements.txt to get 1.0.44 before you build and run the Docker image.

Thanks.

Yijin


(Kieran) #110

There is no value for the response header:

The response headers are:

  1. content-encoding: br

  2. content-length: 25

  3. content-type: text/plain; charset=utf-8

  4. date:

Mon, 04 Mar 2019 13:51:17 GMT

  1. server: uvicorn

  2. status: 500

  3. strict-transport-security: max-age=315360000;


(NOHA) #111

Hi @anurag,
I have signed up to Render but when I tried to confirm my account through the received link I got ‘invalid or expired activation link’.


(building render.com) #112

I just reset your emails. Try signing up again?


(NOHA) #114

Now it’s working. Thanks


(Amrit ) #115

@anurag, OMG super easy to use and a great help that there is starter code to help guide the process. :100: Only issue during the process was an error (mentioned before in this thread:

AttributeError: Can’t get attribute ‘ImageItemList’ on <module ‘fastai.vision.data’ from ‘/usr/local/lib/python3.7/site-packages/fastai/vision/data.py’>
The command ‘/bin/sh -c python app/server.py’ returned a non-zero code: 1

But replacing the fastai version in the requirements.txt fixed the issue as mentioned by @utkb

What I love about render:

  • Much much much easier to use IMO when compared to deploying on heroku or AWS (sometimes you just want to deploy and not worry about how to deploy! :slight_smile: )
  • I like the fact that it renders directly from gitub - easier to navigate
  • Starter code a huge help when compared to reading documentation
  • Love the horse images (I think - or donkey?) when done!

Is there a way to customize the url for the deployment?


(building render.com) #116

Thanks for the kind words! You can add a custom domain to your Render app: https://render.com/docs/custom-domains/


(Wayde Gilliam) #117

Hi @anurag,

First of all thank you for responding to all of these questions, I really appreciate it. I don’t believe this has been asked yet, but when I’m deploying my web app (automatically by pushing my github repo or manually via Render console) and it fails deploying, how do I troubleshoot my problems? Just now I manually deployed my web app and I get a terminal feed, but it just stops after a certain point with no error message in the log when the deployment fails.

Thanks,
Wayde


(building render.com) #118

Typically you’d integrate an error tracking system into your app or log additional info when it comes up. It’s possible your server isn’t coming up in the first place. Feel free to DM me with your Render account email and I’ll take a look.


(building render.com) #119

I just updated export.pkl in the sample docs to a file exported with the latest version of fastai. This means builds from the sample repo should now work out of the box without needing to use an older version of fastai.


(Amrit ) #120

fyi: using a custom trained model I had to change requirements.txt from:

fastai==1.0.43.post1

which prevented the error

AttributeError: Can’t get attribute ‘ImageItemList’ on <module ‘fastai.vision.data’

back to

fastai

as the new error I was getting was the following:

AttributeError: Can’t get attribute ‘ImageList’ on <module ‘fastai.vision.data’

and then the rendering worked fine.


(Chris Pontarolo-Maag) #121

I’m trying to pass the image selected from the button in the starter app to OpenCV. Would someone be able to point me in the right direction to how I might modify the starter app server.py? I suspect I need to adjust this section: @app.route('/analyze', methods=['POST']).

I’m trying to get the image into image = cv2.imread(img), do several steps within OpenCV, and then visualize the output with cv2.imshow("Result", final_output). All of the processing in this project would be within OpenCV, so this portion within server.py that creates the data variable

# async def download_file(url, dest):
#     if dest.exists(): return
#     async with aiohttp.ClientSession() as session:
#         async with session.get(url) as response:
#             data = await response.read()
#             with open(dest, 'wb') as f: f.write(data)

I don’t think would be needed, which is how it looks like the later block here

data = await request.form()
img_bytes = await (data['file'].read())
img = open_image(BytesIO(img_bytes))

is currently setting up the image to be taken in for the learner from fastai. Any advice on this one?


(Chris Pontarolo-Maag) #122

This seems to be what was needed in case anyone else is trying to do the same thing:

async def analyze(request):
    data = await request.form()
    img_bytes = await (data['file'].read())
    image = cv2.imdecode(np.fromstring(img_bytes, np.uint8), 1)

(building render.com) #123

Nice work!


#125

EDIT: FIXED. Changed requirements to fastai==1.0.48 (the version that was running on my server)

I’m trying to deploy an NLP model using Render. However, I keep getting an error relating to FastAI’s TokenizeProcessor function. My hunch is that I specified the wrong version of FastAI with the requirements.txt?

Mar 21 08:58:56 PM Traceback (most recent call last):
File “app/server.py”, line 45, in
learn = loop.run_until_complete(asyncio.gather(*tasks))[0]
File “/usr/local/lib/python3.7/asyncio/base_events.py”, line 584, in run_until_complete
return future.result()
File “app/server.py”, line 33, in setup_learner
learn = load_learner(path, export_file_name)
File “/usr/local/lib/python3.7/site-packages/fastai/basic_train.py”, line 586, in load_learner
src = LabelLists.load_state(path, state.pop(‘data’))
File “/usr/local/lib/python3.7/site-packages/fastai/data_block.py”, line 562, in load_state
train_ds = LabelList.load_state(path, state)
File “/usr/local/lib/python3.7/site-packages/fastai/data_block.py”, line 674, in load_state
res = cls(x, y, tfms=state[‘tfms’], tfm_y=state[‘tfm_y’], **state[‘tfmargs’]).process()
File “/usr/local/lib/python3.7/site-packages/fastai/data_block.py”, line 696, in process
self.x.process(xp)
File “/usr/local/lib/python3.7/site-packages/fastai/data_block.py”, line 75, in process
for p in self.processor: p.process(self)
File “/usr/local/lib/python3.7/site-packages/fastai/text/data.py”, line 291, in process
ds.items = _join_texts(ds.items, self.mark_fields, self.include_bos, self.include_eos)
AttributeError: ‘TokenizeProcessor’ object has no attribute ‘include_bos’
Mar 21 08:58:56 PM error building image: error building stage: waiting for process to exit: exit status 1
Mar 21 08:58:56 PM error: exit status 1