Azure / aml-deploy

GitHub Action that allows you to deploy machine learning models in Azure Machine Learning.
MIT License
41 stars 18 forks source link

Can not load the model in score.py #63

Open VokaCv opened 2 years ago

VokaCv commented 2 years ago

Hi,

I have a registered model that I want to deploy, but when trying to load it with:

in score.py:

import tensorflow.keras.models import load_model
model_path = os.path.join(os.getenv("AZUREML_MODEL_DIR"), 
                            "outputs", "best_model")
model = load_model(model_path)

I get the error that saved_model.pb is not found in the folder. If you look in registered model/Artifacts/ the file saved_model.pb exists

raise IOError("SavedModel file does not exist at: %s/{%s|%s}" %
OSError: SavedModel file does not exist at: /var/azureml-app/azureml-models/p8_model/27/outputs/best_model/{saved_model.pbtxt|saved_model.pb}

What can be the issue here?

I just realized that azureml copies the model folder hierarchy inconsistently from one deploy to another. How to know in what folder the final model will be? (For one deploy it was outputs/best_model, for another it was without outputs folder)

Regards, Voka