Code Monkey home page Code Monkey logo

pipelines-azureml's Introduction

Introduction

This repo shows an E2E training and deployment pipeline with Azure Machine Learning's CLI. For more info, please visit Azure Machine Learning CLI documentation.

This example requires some familiarity with Azure Pipelines or GitHub Actions. For more information, see here.

Instructions

Detailed Instructions

First, fork (or clone) the repository to your own GitHub account, so that you can make modification to your pipelines. From there, follow these instructions to get the whole setup and demo up and running:

๐Ÿ“„ Detailed step-by-step setup instructions ๐Ÿ“„

Short Instructions

If you are familar with Azure Machine Learning and Azure DevOps, you can follow these shortend instructions:

  1. Fork or clone this repo
  2. Create an Azure Machine Learning workspace named aml-demo in a resource group named aml-demo
  3. Create a new project in Azure DevOps/Pipelines
  4. Goto Project settings, select Service connections, create a new connection of type Azure Resource Manager, select Service principal (automatic) and configure it to the Resource Group of your Machine Learning workspace. Name it azmldemows. For more details see here or follow the tutorial.
  5. Create a new pipeline for the project, point it to the pipelines/diabetes-train-and-deploy.yml file in your forked GitHub repo. This defines an example pipeline.
  6. Modify the pipelines/diabetes-train-and-deploy.yml and change the ml-rg variable to the Azure resource group that contains your workspace. You may also change the ml-ws variable to the name of your Azure Machine Learning service workspace.
  7. Run the pipeline

Declare variables for CI/CD pipeline

In case you want to leverage an existing ML workspace, you can customize it in the example pipeline pipelines/diabetes-train-and-deploy.yml:

 - ml-ws-connection: 'azmldemows'  # Workspace Service Connection name
 - ml-ws: 'aml-demo'               # AML Workspace name
 - ml-rg: 'aml-demo'               # AML resource Group name
 - ml-ct: 'cpu-cluster-1'          # AML Compute cluster name
 - ml-path: 'models/diabetes'      # Model directory path in repo
 - ml-exp: 'exp-test'              # Experiment name
 - ml-model-name: 'diabetes-model' # Model name
 - ml-aks-name: 'aks-prod'         # AKS cluster name

Run CLI scripts to create training compute, train model, register model, deploy model

You can also manually emulate the example pipeline on your machine by running the following commands (make sure to substitue the variables from above):

az extension add -n azure-cli-ml

cd models/diabetes/
az ml folder attach -w $(ml-ws) -g $(ml-rg)
az ml computetarget create amlcompute -n $(ml-ct) --vm-size STANDARD_D2_V2 --max-nodes 1
az ml run submit-script -c config/train --ct $(ml-ct) -e $(ml-exp) -t run.json train.py
az ml model register -n $(ml-model-name) -f run.json --asset-path outputs/ridge_0.95.pkl -t model.json
az ml model deploy -n diabetes-qa-aci -f model.json --ic config/inference-config.yml --dc config/deployment-config-aci.yml --overwrite
az ml computetarget create aks --name $(ml-aks-name) --cluster-purpose DevTest
az ml model deploy --name diabetes-prod-aks --ct $(ml-aks-name) -f model.json --ic config/inference-config.yml --dc config/deployment-config-aks.yml  --overwrite

Further notes

If you want to scope your project to your Azure Machine Learning service workspace, you can install the Machine Learning DevOps extension in your Azure DevOps project.

pipelines-azureml's People

Contributors

blackmist avatar csiebler avatar jpe316 avatar microsoftopensource avatar msftgits avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.