I noticed that the version of fastai in your requirements.txt is 1.0.52 last time I checked we are up to version 1.0.58. However to make your app work I suggest the following.
Please search this forum for “pip list” and carry out the instructions in posts such as this one Deployment Platform: Render ✅.
Basically the file versions in your requirements.txt must match the file versions of the system that you created the model file on. It is normally best to do this as soon as you train the model as sometimes libraries change while you are creating models.
The three most common causes of stuck in analyzing are:
Browser issue (my classifiers don’t work on my mac using an older version of Safari browser)
There is an issue with your model file.
The library versions between the platform you trained your model on and the platform you are deploying your model on are different.
Can you print the error you have in the console on render.com
Can you print the requirements.txt file you are using on render.com
Can you print a !pip list on your development platform and on your render.com app
You only need to list the files that are in the requirements.txt file(pip list lists all libraries but we are only interested in the ones the app uses.)
If you can do this then it will make it easier to solve your problem.
Try your app with a different browser my classifiers always work in the current versions of Chrome and Firefox.
I am trying to use annoy in render, but it appears like it is missing a c++ dependency, I have tried several different ways, but I haven’t found a way to make it work. Does anyone have any Ideas how to fix this?
If I want to show the confidence level along with the result? (like I am 98% sure it’s a Tennis Racket). Is there an easy way to do it by using “outputs” from the prediction call?
How do I integrate this into my website for a while?
Does your app work in your standalone environment?
This makes a lot of difference.
I haven’t really used the console environment other than looking at errors.
I use Docker on my desktop build the app then upload it to render. I do all my debugging on the local version.
All the issues are generally resolved updating the requirements.txt and the Dockerfile.
Once my app is on render.com if I have a missing library I either add it in the requirements.txt or Download it using the Dockerfile, then redeploy the model.
eg. see commands in this file Dockerfile all terminal commands can be run within this file using the RUN command.
Have you searched this thread for “pip list”. Having bulit more than 50 model apps many of the apps issues have been resolved using this command to amend the requirements.txt in the deployed model.
Hi mrfabulous1, it works well now, I changed the pythorch and fastai version in the requirements.txt based on notebook versions.
It doen’t work the model, always predict the dogs and cats (and other stuff) as a Boxer…but it is another problem. if you have ever heard this same problem please let me know.
Hi diegobodner I am glad to hear your model is now working.
There is probably a better thread than this one for discussing your issue.
I haven’t seen your particular issue before. However I am assuming your model is supposed to predict cats and dogs if this is the case then I would go to the section of the notebook below and check the confusion matrix.
I would check my directories container images of the correct class.
Also muellerzr has an image cleaner that you could try if that is an issue.
Not sure what you mean by
other stuff
But if you mean it predicts images of other things as a boxer even if they are not cats and dogs,
then this is another feature of the classifier which people are trying to find a solution to.
See this thread here. Handle data that belongs to classes not seen in training or testing
Hi, I am trying to run the bear classification on my local system but facing this error:
python app/server.py serve
Error:
C:\Program Files\Anaconda3\lib\site-packages\torch\serialization.py:435: SourceChangeWarning: source code of class ‘torch.nn.modules.linear.Linear’ has changed. you can retrieve the original source code by accessing the object’s source attribute or set torch.nn.Module.dump_patches = True and use the patch tool to revert the changes.
warnings.warn(msg, SourceChangeWarning)
INFO: Started server process [4524]
INFO: Waiting for application startup.
INFO: Uvicorn running on http://0.0.0.0:5000 (Press CTRL+C to quit)
INFO: (‘127.0.0.1’, 49211) - “GET / HTTP/1.1” 500
ERROR: Exception in ASGI application
. . .
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: ‘charmap’ codec can’t decode byte 0x90 in position 247: character maps to
In the first instance if you have not done so, I suggest you search this thread for posts relating to “pip list” and update the requirements.txt in the bear classifier to match the library versions of the platform you trained your model on.
I am assuming your bear model (pkl file) works in the notebook you created it in.
Hi there!
When I try to deploy my model in Render I get the following error (I’m using the bear template only with modified classes and export_file_url):
Nov 28 11:15:02 AM INFO[0064] RUN python app/server.py
Nov 28 11:15:15 AM Traceback (most recent call last):
File “app/server.py”, line 48, in
learn = loop.run_until_complete(asyncio.gather(*tasks))[0]
File “/usr/local/lib/python3.7/asyncio/base_events.py”, line 579, in run_until_complete
return future.result()
File “app/server.py”, line 35, in setup_learner
learn = load_learner(path, export_file_name)
File “/usr/local/lib/python3.7/site-packages/fastai/basic_train.py”, line 598, in load_learner
state = torch.load(source, map_location=‘cpu’) if defaults.device == torch.device(‘cpu’) else torch.load(source)
File “/usr/local/lib/python3.7/site-packages/torch/serialization.py”, line 387, in load
return _load(f, map_location, pickle_module, **pickle_load_args)
File “/usr/local/lib/python3.7/site-packages/torch/serialization.py”, line 564, in _load
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, ‘{’.
Nov 28 11:15:15 AM error building image: error building stage: waiting for process to exit: exit status 1
Nov 28 11:15:15 AM error: exit status 1