Git Product home page Git Product logo

mlops-demo-v1's Introduction

mlops-demo

This repo shows a simple MLOps implementation for automating model training and deployment.

Setup & Demo Flow

This gives a short, high-level overview of how this repo may be used.

Interactive demo part

  1. If required, create an Azure Machine Learning workspace
  2. Create a tabular dataset from data/german_credit_data.csv and name it german_credit_dataset (download the file to your machine and select From Local File when creating a new Dataset)
  3. Create a file dataset from data/german_credit_data.csv and name it german_credit_file (use From Datastore and point to the same file as in the prior step)
  4. Clone the whole repo into a Compute Instance
  5. Walk through the following notebooks
  6. For deployment to AKS, make sure to create an AKS cluster in AML that has SSL enabled (using the Microsoft certificate)

MLOps demo part

Simple MLOps pipelines

  1. Create a new project in Azure DevOps
  2. Fork this repo or import it into Azure DevOps (so that you can make changes to the repo)
  3. Create a service connection to your Azure Machine Learning workspace and use the name aml-workspace-connection
  4. Edit pipelines/german-credit-config.yml and adapt the values to point to your workspace
  5. Import the following pipelines into DevOps
  6. Run the pipelines

Staged MLOps pipelines

  1. First, get the simple pipelines from pipelines/ running
  2. Edit pipelines-staged/german-credit-config-dev.yml and pipelines-staged/german-credit-config-prod.yml and adapt the values to point to your dev and prod workspaces
  3. Import the following pipeline into DevOps
  4. Run the pipeline

Conventions

This repo is fully based on conventions in order to make MLOps reusable and easily scaleable. The directory structure is as follows:

pipelines
    \- german-credit-config.yml - Configuration for german credit model
    \- german-credit-deploy.yml - Deployment pipeline for german credit model
    \- german-credit-train-and-register.yml - Pipline for training and registering the base german credit model
models
    \- model1
        train.py (entry file for training)
        score.py (entry file for scoring)
        \- config
            deployment-config-aks.yml - Deployment infrastructure definition (e.g., AKS configuration)
            inference-conda.yml - Conda environement definition for inferencing/scoring
            inference-config.yml - Azure Machine Learning config for inferencing
            train-conda.yml - Conda environement definition for training
    \- model2
        ...same file and folder structure...

Testing

This snipped can be used to manually showcase/test the deployed model on ACI:

import requests
import json

url = '<scoring url>'
key = '<api key>'

test_data = {
  'data': [{
    "Age": 20,
    "Sex": "male",
    "Job": 0,
    "Housing": "own",
    "Saving accounts": "little",
    "Checking account": "little",
    "Credit amount": 100,
    "Duration": 48,
    "Purpose": "radio/TV"
  }]
}

headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer ' + key}
resp = requests.post(url, json=test_data, headers=headers)

print("Prediction (good, bad):", resp.text)

Further Work

โญ A fully documented starting template for Azure Machine Leraning with MLOps can be found here: microsoft/aml-acceleration-template. This includes model training, validation, testing, deployment, pipelines, and several other production-grade capabilties.

mlops-demo-v1's People

Contributors

csiebler avatar jonasrotter avatar

Watchers

 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.