Hi All,
One of the primary tasks for any machine learning practitioner or data scientist is to operationalize machine learning models into a serving environment. This first blog post would be showing how to operationalize models using Azure Machine Learning (AML) workbench in a step to deploy models as realtime webservices into Azure.
First, Once you have your model ready to be operationlized, you need to create and set the right execution environment for your model to be deployed to in Azure.
A) Creating a machine learning model management service using CLI in Azure
First, You need to know that to provision a ml model management service in azure that acts as a serving environment for your models. You can create a new one using azure portal or by executing this command in CLI from your computer:
az ml account modelmanagement create --location westcentralus -n mymodelmanagement -g myresourcegroup
-n: where you can specify the name of the service when it is provisioned in azure.
-g: the resource group name that you would like this account model management services assigned to.
Checkpoint #1: You need to make sure to provision a ML model management account is created in azure before going forward with the rest of this article.
B) Configure the execution environment using Azure Machine Learning Workbench using CLI
Once you have a model management account, you would not be able deploy models from your workbench tool into azure using docker container images unless you provision an environment. In the below steps, we will walk through how to accomplish this.
Follow the below steps:
1) From AML workbench, open the command line window from File --> Open Command prompt.
2) You need to login to your azure account, type the following command:
az login
3) Follow the screen instructions by logging into your azure subscription.
4) Make sure that you are using the right subscription, The below first command list all subscriptions you have, the second line set the intended subscription you would like to use.
az account list -o table
az account set -s <subscriptionId>
5) Verify that your current account is set correctly by exeucting the following command:
az account show
6) To create an environment which creates set of cloud assets containing blob storage, container registry and other assets in a resource group to host docker images for your models into the cloud:
az ml env setup -n mymldevenv --location westcentralus
Please note that we created an environment on the same location of the model management services in west central us.
7) Set the model management account
az ml account modelmanagment set -n mymldevenv -g mymldevenvrg
Please note that when we created an environment in step #6, it has created a resource group for this environment with the same name with rg suffix, which we used in this step to set our model management service we created in step A with this environment.
Checkpoint #2: An AML workbench environment and a model management service were provisioned before moving forward to the rest of this article.
8) Now, we are going to set the correct execution environment in CLI to connect to the provisioned environment and therefore the model management service in azure.
a) To see available environments, run:
az ml env list
b) In my case, i do have few of these for different project. To set an active environment, run:
az ml env set -n mymodelmanagement -g myresourcegroup
c) Once you run this command, you should see this confirmation message in the console window
Compute set to mymldevenv .
9) Every time you re-open AML workbench, you need to make sure to set the right environment before deploying models as webservices into azure model management service.
In the second part, I will take the next step of publishing models into real-time web services in azure model management service in azure.
Enjoy ML :-)
- Mostafa
One of the primary tasks for any machine learning practitioner or data scientist is to operationalize machine learning models into a serving environment. This first blog post would be showing how to operationalize models using Azure Machine Learning (AML) workbench in a step to deploy models as realtime webservices into Azure.
First, Once you have your model ready to be operationlized, you need to create and set the right execution environment for your model to be deployed to in Azure.
A) Creating a machine learning model management service using CLI in Azure
az ml account modelmanagement create --location westcentralus -n mymodelmanagement -g myresourcegroup
-n: where you can specify the name of the service when it is provisioned in azure.
-g: the resource group name that you would like this account model management services assigned to.
Checkpoint #1: You need to make sure to provision a ML model management account is created in azure before going forward with the rest of this article.
B) Configure the execution environment using Azure Machine Learning Workbench using CLI
Once you have a model management account, you would not be able deploy models from your workbench tool into azure using docker container images unless you provision an environment. In the below steps, we will walk through how to accomplish this.
Follow the below steps:
1) From AML workbench, open the command line window from File --> Open Command prompt.
2) You need to login to your azure account, type the following command:
az login
3) Follow the screen instructions by logging into your azure subscription.
4) Make sure that you are using the right subscription, The below first command list all subscriptions you have, the second line set the intended subscription you would like to use.
az account list -o table
az account set -s <subscriptionId>
5) Verify that your current account is set correctly by exeucting the following command:
az account show
6) To create an environment which creates set of cloud assets containing blob storage, container registry and other assets in a resource group to host docker images for your models into the cloud:
az ml env setup -n mymldevenv --location westcentralus
Please note that we created an environment on the same location of the model management services in west central us.
7) Set the model management account
az ml account modelmanagment set -n mymldevenv -g mymldevenvrg
Please note that when we created an environment in step #6, it has created a resource group for this environment with the same name with rg suffix, which we used in this step to set our model management service we created in step A with this environment.
Checkpoint #2: An AML workbench environment and a model management service were provisioned before moving forward to the rest of this article.
8) Now, we are going to set the correct execution environment in CLI to connect to the provisioned environment and therefore the model management service in azure.
a) To see available environments, run:
az ml env list
b) In my case, i do have few of these for different project. To set an active environment, run:
az ml env set -n mymodelmanagement -g myresourcegroup
c) Once you run this command, you should see this confirmation message in the console window
Compute set to mymldevenv .
9) Every time you re-open AML workbench, you need to make sure to set the right environment before deploying models as webservices into azure model management service.
In the second part, I will take the next step of publishing models into real-time web services in azure model management service in azure.
Enjoy ML :-)
- Mostafa