-1

I have same problem as

Why does my ML model deployment in Azure Container Instance still fail?

but the above solution does not work for me. Besides I get additional errors like belos

code": "AciDeploymentFailed",
"message": "Aci Deployment failed with exception: Your container application 
crashed. This may be caused by errors in your scoring file's init() 
function.\nPlease check the logs for your container instance: anomaly-detection-2. 
From the AML SDK, you can run print(service.get_logs()) if you have service object 
to fetch the logs. \nYou can also try to run image 
mlad046a4688.azurecr.io/anomaly-detection- 
2@sha256:fcbba67cf683626291c1bd084f31438fcd641ddaf80f9bdf8cea274d22d1fcb5 locally. 
Please refer to http://aka.ms/debugimage#service-launch-fails for more 
information.",
"details": [
{
  "code": "CrashLoopBackOff",
  "message": "Your container application crashed. This may be caused by errors in 
your scoring file's init() function.\nPlease check the logs for your container 
instance: anomaly-detection-2. From the AML SDK, you can run 
print(service.get_logs()) if you have service object to fetch the logs. \nYou can 
also try to run image mlad046a4688.azurecr.io/anomaly-detection- 
2@sha256:fcbba67cf683626291c1bd084f31438fcd641ddaf80f9bdf8cea274d22d1fcb5 locally. 
Please refer to http://aka.ms/debugimage#service-launch-fails for more 
information."
}
]
}

It keeps pointing to scoring file but not sure what is wrong here

import numpy as np
import os
import pickle
import joblib
#from sklearn.externals import joblib
from sklearn.linear_model import LogisticRegression
from azureml.core.authentication import AzureCliAuthentication
from azureml.core import Model,Workspace
import logging

logging.basicConfig(level=logging.DEBUG)

    def init():
    global model
    from sklearn.externals import joblib
    # retrieve the path to the model file using the model name
    model_path = Model.get_model_path(model_name='admlpkl')
    print(model_path)
    model = joblib.load(model_path)
    #ws = Workspace.from_config(auth=cli_auth)
    #logging.basicConfig(level=logging.DEBUG)
    #modeld = ws.models['admlpkl']
    #model=Model.deserialize(ws, modeld)

def run(raw_data):
    # data = np.array(json.loads(raw_data)['data'])
    # make prediction
    data = json.loads(raw_data)
    y_hat = model.predict(data)
    #r = json.dumps(y_hat.tolist())
    r = json.dumps(y_hat)
    return r

The model has depencency on other file which I have added in

image_config = ContainerImage.image_configuration(execution_script="score.py", 
                                              runtime="python", 
                                              conda_file='conda_dependencies.yml',
                                              dependencies=['modeling.py']

The logs are too abstract and really does not help to debug.I am able to create the image but provisioning service fails

Any inputs will be appreciated

user437777
  • 1,423
  • 4
  • 17
  • 28

1 Answers1

1

Have you registered the model 'admlpkl' in your workspace using the register() function on the model object? If not, there will be no model path and that can cause failure.

See this section on model registration: https://learn.microsoft.com/en-us/azure/machine-learning/service/how-to-deploy-and-where#registermodel

Please follow the below to register and deploy the model to ACI. enter image description here enter image description here

Ram
  • 2,459
  • 1
  • 7
  • 14