Getting error while deploying lesson 2 bear classification to google app engine

Hi

I am trying to deploy Jeremy’s bear classification model from Lesson 2 into production in Google App Engine . I am following the steps in the page below : https://course.fast.ai/deployment_google_app_engine.html

I am getting the error below at the end. If someone can tell me what i am doing wrong leading to the error below :
Traceback (most recent call last):
File “app/server.py”, line 37, in
learn = loop.run_until_complete(asyncio.gather(*tasks))[0]
File “/usr/local/lib/python3.6/asyncio/base_events.py”, line 484, in run_until_complete
return future.result()
File “app/server.py”, line 31, in setup_learner
learn = create_cnn(data_bunch, models.resnet34, pretrained=False)
NameError: name ‘create_cnn’ is not defined
The command ‘/bin/sh -c python app/server.py’ returned a non-zero code: 1
ERROR
ERROR: build step 0 “gcr.io/cloud-builders/docker” failed: exit status 1

Thanks
Kaushik Saha

Plus you, now 3 persons are having the same error on “NameError: name ‘create_cnn’ is not defined”…

How do we highlight this problem to fastai team…?

could you post the version of fastai that is being installed in the Google App Engine. I think they have changed the signature/name of the function that created CNN learner, which could result in this error.

You can use

from fastai import __version__
print(__version__)

to get the version of fastai.
can you log this somewhere and check the value if it is the latest?

Hi @coolkaushik22, @Vishesh1042, @SiewLin

If you get the version from above and it says
1.0.47-post1, you can fix the name error by replacing create_cnn method
with cnn_learner with all the same parameters. The fastai team
has deprecated the method create_cnn with cnn_learner but haven’t
gotten around to updating the docs.
HTH.
I’ve already sent a message to the fastai devs here regarding the breaking change. I hope they respond.

Best regards,
Butch

2 Likes

Hi,

Thanks for the input and help here!
I couldnt check the version of fastain in GCP as I am not sure how to do that (please let me know how) , but i changed the create_cnn to cnn_learner in server.py code downloaded from fastai git.

With this change my code ran in GCP, but when i opened the app link and uploaded a bear picture for scoring, the page was stuck at ‘analysing’ without any result.
Kindly let me know what i should do at this step to fix this ?

Regards
Kaushik Saha

You should be able to check what version of fast.ai you have with the code @Vishesh1042 provided

from fastai import __version__
print(__version__)