0

After having solved Why does my ML model deployment in Azure Container Instance still fail? and having deployed on ACI, I am using Azure Machine Learning Service to deploy a ML model as web service on AKS.

My current (working) ACI-deployment code is

from azureml.core.webservice import Webservice, AciWebservice
from azureml.core.image import ContainerImage

aciconfig = AciWebservice.deploy_configuration(cpu_cores=1, 
                      memory_gb=8, 
                      tags={"data": "text",  "method" : "NB"}, 
                      description='Predict something')


image_config = ContainerImage.image_configuration(execution_script="score.py", 
                      docker_file="Dockerfile",
                      runtime="python", 
                      conda_file="myenv.yml")

image = ContainerImage.create(name = "scorer-image",
                      models = [model],
                      image_config = image_config,
                      workspace = ws
                      )

service_name = 'scorer-svc'
service = Webservice.deploy_from_image(deployment_config = aciconfig,
                                        image = image,
                                        name = service_name,
                                        workspace = ws)

I would like to modify it so to deploy on AKS, but looks more convoluted than I expected, as I imagined moving from ACI to AKS (i.e. from test to production) to be a routine operation. Still, it seems to need a bit more of changes in the code than I thought:

  • AKS seems to require an InferenceConfig object (?)
  • with AKS there's no method like deploy_from_image for deployment from my existing Docker image (?)

Can deployment be done on AKS by performing minimal changes to the ACI code instead?

Davide Fiocco
  • 5,350
  • 5
  • 35
  • 72
  • 1
    aci and aks are not related. moving from aci to aks is like targeting another platform, really. – 4c74356b41 May 09 '19 at 10:11
  • 1
    Do you try to make the AksWebservice.deploy_configuration instead of the AciWebservice.deploy_configuration and use the method Webservice.deploy_from_image? – Charles Xu May 10 '19 at 01:48

1 Answers1

1

From the code that you have provided, when you deploy the application in the ACI using the method Webservice.deploy_from_image with the parameters deployment_config and container image. The deployment_config makes by the AciWebservice.deploy_configuration.

When you take a look at the ML about AKS, you can also find the method AksWebservice.deploy_configuration. So you just need to change the method AciWebservice.deploy_configuration into AksWebservice.deploy_configuration, then the application can be deployed from ACI into AKS. And it's the minimal changes. Also, it can deploy from the docker image.

Charles Xu
  • 29,862
  • 2
  • 22
  • 39