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
If you haven’t done so already, can I suggest you search this thread for posts relating to “pip list” and update the requirements.txt file in the your classifier to match the library versions of the platform you trained your model on.
This is absolutelyessential for your model to work,
I am assuming your bear model (pkl file) works in the notebook you created it in.
Thank you very much for your answer, that helped! Im using Colab as plattform and I pip listed the packages and updated the requirements.txt file.
Now I get the following error:
Great! That worked!
I came a little bit further once I changed both calls, for torch and for torchvision.
Now this is the error I encounter:
Nov 29 09:11:41 PM INFO[0261] RUN python app/server.py
Nov 29 09:11:53 PM 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 616, 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 426, in load
return _load(f, map_location, pickle_module, **pickle_load_args)
File “/usr/local/lib/python3.7/site-packages/torch/serialization.py”, line 603, in _load
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, ‘\x0a’.
I was able to get through to the link generation portion of the deployment tutorial, but I can’t figure out the customize app section. Where is the server.py and the app directory and how do I edit it?
In the guide it tells you to fork the repository, if you have done this you should have your own copy. If you double click the repository folder you should see something like this
you can make your changes here. Once you have committed the changes you can, then pull your repository again into render and rerun your app. If you search this thread you will see a good selection of the frequent problems people have deploying their first model.
You should also search for “pip list” as you need to also amend your requirements.txt file.
Dec 17 12:41:52 PM INFO[0140] COPY app app/
Dec 17 12:41:52 PM INFO[0140] RUN python app/server.py
Dec 17 12:41:56 PM Segmentation fault (core dumped)
Dec 17 12:41:56 PM error building image: error building stage: waiting for process to exit: exit status 139
Dec 17 12:41:57 PM error: exit status 1
As far as I can tell I’ve just followed what the instructions say…
Any idea why this might be? Let me know if more info is needed to understand the problem.
Basically search this thread for “!pip list”, you run this on the platform you created your model on and record the library versions and update your requirements.txt in your app then redeploy.
I use google colab to build my models so it is a different environment to render, so as you are using docker to deploy the model this step must be done.
Once this has been done, you may have some other issues, but this is the most important first step.