Skip to content

Latest commit

 

History

History
165 lines (108 loc) · 5.52 KB

File metadata and controls

165 lines (108 loc) · 5.52 KB

Import the workshop repo to Azure DevOps

Go to your Azure DevOps project, into the Repos area. Click on the Git repo dropdown at the top of the page and then on "Import Repository".

Under clone URL, you can put https://github.com/krisbock/azureml-workshop-2020.git

Next, let's connect your ML workspace to Azure DevOps.

Connect your ML workspace to a DevOps project

This workshop leverages the Azure Machine Learning extension that should be installed in your organization from the marketplace.

In order to set up automated training and deployment, you need to create a service connection to your ML workspace. To get there, go to your Azure DevOps project settings page (by clicking on the gear wheel to the bottom left of the screen), and then click on Service connections under the Pipelines section. The Azure ML extension uses an Azure Resource Manager service connection.

Important: Make sure you point it to workshop workspace and be sure to name the Service connection aml-workshop!

Note: Creating the Azure Resource Manager service connection scope requires 'Owner' or 'User Access Administrator' permissions on the subscription. You'll also need sufficient permissions to register an application with your Azure AD tenant, or you can get the ID and secret of a service principal from your Azure AD Administrator. That principal must have 'Contributor' permissions on the subscription.

This is how your service connection looks like. Make sure to pick your resource group and AML workspace.

The first phase of bringing your ML workflow to production is being able to reproduce and automate the model training process.

In this repo, you will find four pipelines:

The pipelines derive their configuration variables from:

Create pipelines

Goto Pipelines (Rocket symbol), select Create Pipeline and pick Azure Repos Git:

Select your repo:

Select Existing Azure Pipelines YAML file:

Select the pipeline /3-mlops/pipelines/deploy-infrastructure.yml from the list:

Instead of hitting Run, hit the down arrow and select Save:

Then select the three dots and select Rename:

Rename the pipeline to deploy-infrastructure and hit Save:

Repeat the steps above three times and import the following pipelines:

  • /3-mlops/pipelines/train-and-register-model.yml and rename to train-and-register-model
  • /3-mlops/pipelines/deploy-model.yml and rename to deploy-model
  • /3-mlops/pipelines/delete-infrastructure.yml and rename to delete-infrastructure

Once done, your pipelines should look like this (select All tab):

Run pipelines

For sake of this workshop, we have disabled automatic triggering of the pipelines. Hence, we can now manually run three out of the four pipelines manually:

  1. deploy-infrastructure
  2. train-and-register-model
  3. deploy-model

The last pipeline delete-infrastructure can be used to get rid of the AKS cluster (for saving cost).

Once all three pipelines ran, we should be able to see in the AzureML studio:

  • New experiment run should have been created
  • Model should have been registered
  • A new endpoint should have been registerd

New experiment:

Model registered:

Our new endpoint:

We can now try out the model by using the Consume tab under the AKS endpoint:

POST http://<your endpoint address>:80/api/v1/service/ibm-attrition-aks/score HTTP/1.1
Authorization: Bearer <your key>
Content-Type: application/json

{
	"data": [{
		"Age": 41,
		"BusinessTravel": "Travel_Rarely",
		"DailyRate": 1102,
		"Department": "Sales",
		"DistanceFromHome": 1,
		"Education": 2,
		"EducationField": "Life Sciences",
		"EnvironmentSatisfaction": 2,
		"Gender": "Female",
		"HourlyRate": 94,
		"JobInvolvement": 3,
		"JobLevel": 2,
		"JobRole": "Sales Executive",
		"JobSatisfaction": 4,
		"MaritalStatus": "Single",
		"MonthlyIncome": 5993,
		"MonthlyRate": 19479,
		"NumCompaniesWorked": 8,
		"OverTime": "No",
		"PercentSalaryHike": 11,
		"PerformanceRating": 3,
		"RelationshipSatisfaction": 1,
		"StockOptionLevel": 0,
		"TotalWorkingYears": 8,
		"TrainingTimesLastYear": 0,
		"WorkLifeBalance": 1,
		"YearsAtCompany": 6,
		"YearsInCurrentRole": 4,
		"YearsSinceLastPromotion": 0,
		"YearsWithCurrManager": 5
	}]
}

Response:

{"result": [0]}

Perfect, looks like we are done!