1

I'm trying to deploy the azure ml model if not exists in the workspace and when the model is already available in the registered workspace then update the model with the latest version only when an update is available, but I don't know how this works in practice.

The Azure pipelines will run on a weekly schedule.

steps:
- task: AzureCLI@2
  displayName: 'Install AML CLI'
  inputs:
    azureSubscription: $(ml_ws_connection)
    scriptLocation: inlineScript
    scriptType: 'bash'
    inlineScript: 'az extension add -n azure-cli-ml'

- task: AzureCLI@2
  displayName: 'Attach folder to workspace'
  inputs:
    azureSubscription: $(ml_ws_connection)
    workingDirectory: $(ml_path)
    scriptLocation: inlineScript
    scriptType: 'bash'
    inlineScript: 'az ml folder attach -w $(ml_ws) -g $(ml_rg)'


# Add potential automated tests

- task: AzureCLI@2
  displayName: 'Create AKS cluster'
  inputs:
    azureSubscription: $(ml_ws_connection)
    workingDirectory: $(ml_path)
    scriptLocation: inlineScript
    scriptType: 'bash'
    inlineScript: 'az ml computetarget create aks --name $(ml_aks_name) --cluster-purpose DevTest'

- task: AzureCLI@2
  displayName: 'Deploy model to AKS '
  inputs:
    azureSubscription: $(ml_ws_connection)
    workingDirectory: $(ml_path)
    scriptLocation: inlineScript
    scriptType: 'bash'
    inlineScript: 'az ml model deploy --name model1_aks --ct $(ml_aks_name) --ic config/inferenceConfig.json -e $(ml_env_name) --ev $(ml_env_version) --dc config/aksDeploymentConfig-aks.json  --overwrite'

- task: AzureCLI@2
  displayName: 'Update model in AKS '
  inputs:
    azureSubscription: $(ml_ws_connection)
    workingDirectory: $(ml_path)
    scriptLocation: inlineScript
    scriptType: 'bash'
    inlineScript: 'az ml service update --name $(deploy_service_name)
sree
  • 35
  • 1
  • 5

1 Answers1

0

We can do CICD for automated model release as documented here Continuously deploy Azure Machine Learning models - Azure Machine Learning | Microsoft Docs.

Please follow the references for CLI spec. Here is link to update a deployment using configuration.

The ml extension to the Azure CLI is the improved interface for Azure Machine Learning users. It enables you to train and deploy models from the command line, with features that accelerate scaling the data science process up and out, all while tracking the model lifecycle. Using the CLI enables you to run distributed training jobs on GPU compute, automatically sweep hyperparameters to improve your results, and then monitor jobs in the AML studio user interface to see all details including important metrics, metadata and artifacts like the trained model, checkpoints and logs.

Additionally, the CLI is optimized to support YAML-based job, endpoint, and asset specifications to enable users to create, manage, and deploy models with proper CI/CD (or GitOps) best practices for an end-to-end MLOps solution.

To get started with the 2.0 machine learning CLI extension for Azure, please check the link here.

Ram
  • 2,459
  • 1
  • 7
  • 14