question

VikeshKumar-1504 avatar image
0 Votes"
VikeshKumar-1504 asked SnehaAgrawal-MSFT answered

Facing problem in deplying pyhton application from github- unable to load tensorflow saved model in AZURE.

I am trying to deploy a classification TensorFlow model on AZURE from GitHub. It is getting deployed correctly which can be seen from the below logs.
![111656-image.png][1]


But I'm getting an OSError on log Stream saying saved model doesn't exist as shown below. The error msg is highlighted in red.
![111560-image.png][2]

But this is working correctly on local. This model has been checked locally.
The repository for this can be checked at https://github.com/Vikeshkr-DSP/cassava-leaf-disease-prediction.
Thanks in advance for your help.
[1]: /answers/storage/attachments/111656-image.png
[2]: /answers/storage/attachments/111560-image.png

azure-webappsazure-machine-learning
image.png (17.0 KiB)
image.png (200.7 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@VikeshKumar-1504 Are you deploying your model as a web app on Azure? I do not see any steps mentioned in the repo that is trying to use Azure ML workspace and register a model.
The error looks like a web app deployment that you are trying to load using python tensorflow rather than an issue with Azure Machine learning service or the SDK.

Could you please add more details of the deployment steps followed as I think this is an issue with webapp deployment rather than Azure machine learning service.

0 Votes 0 ·

Hello @romungi-MSFT, thanks for your concern and Yes I am trying to deploy my model as a web app. A step-by-step process for deployment -
1. After selecting the option to create the web app, a new resource group was created and selected. The instance was selected as code, runtime stack as python 3.8. OS, region, and Linux plan were left default. Then I clicked on (Review+Create was). Then create.
2. The deployment process started. After its completion, I clicked on resource and moved to the deployment Centre.
3. Code source was selected as GitHub and build provider was changed to "App Service Build Service".
4. Github Organization, repository, and the branch was selected and I clicked on save.
5. Build process for deployment started and was successfully completed as shown.

And I don't think that something is wrong in the deployment process as I have previously deployed some Machine Learning models without TensorFlow and Keras with the same process and the web app was working as expected. I think, there is some problem in reading the saved model but I am not able to find it out as it is working correctly on my local PC.

0 Votes 0 ·

@VikeshKumar-1504 Thanks for confirming the steps followed. I do not have much experience on webapps deployment scenario but I have previously added the azure-webapps tag to this thread so the right community expert could suggest what could be wrong in your deployment or project.

I am not sure if this helps but the azure function app documentation with a similar sample project indicates python 3.8 is not supported and the model format might need to inline with this sample. Maybe, you could try a similar setup.


0 Votes 0 ·

1 Answer

SnehaAgrawal-MSFT avatar image
0 Votes"
SnehaAgrawal-MSFT answered

The above issue on OSError: SavedModel file does not exist at: cassava_leaf.h5/{saved_model.pbtxt|saved_model.pb} was due to a bit large size of model and we did not provide an absolute path to the model location, the application could not find the same during startup.

The issue resolved by manually transferring the h5-model file to a location like /home on the App Service and updated the app.py file to use an absolute path in order to refer the file.

Similar to: model=load_model('/home/cassava_leaf.h5')

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.