aml-deploy icon indicating copy to clipboard operation
aml-deploy copied to clipboard

Can not load the model in score.py

Open VokaCv opened this issue 3 years ago • 0 comments

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

VokaCv avatar Jan 06 '22 14:01 VokaCv