Skip to content

Commit e510028

Browse files
committed
Update code and text
1 parent 2e32fbb commit e510028

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

articles/machine-learning/how-to-deploy-mlflow-models-online-endpoints.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.subservice: inferencing
88
author: msakande
99
ms.author: mopeakande
1010
ms.reviewer: fasantia
11-
ms.date: 01/16/2025
11+
ms.date: 01/24/2025
1212
ms.topic: how-to
1313
ms.custom: deploy, mlflow, devplatv2, no-code-deployment, devx-track-azurecli, cliv2, update-code
1414
# customer intent: As a developer, I want to see how to deploy an MLflow model to an online endpoint so that I can use the model to make predictions in real time.
@@ -57,7 +57,7 @@ For no-code-deployment, Azure Machine Learning:
5757

5858
# [Python (MLflow SDK)](#tab/mlflow)
5959

60-
- Install the MLflow SDK package, `mlflow`, and the Azure Machine Learning plug-in for MLflow, `azureml-mlflow`.
60+
- Install the MLflow SDK package, `mlflow`, and the Azure Machine Learning integration package for MLflow, `azureml-mlflow`.
6161

6262
```bash
6363
pip install mlflow azureml-mlflow
@@ -73,11 +73,11 @@ For no-code-deployment, Azure Machine Learning:
7373

7474
## About the example
7575

76-
The example shows you how to deploy an MLflow model to an online endpoint to perform predictions. The example uses an MLflow model that's based on the [Diabetes dataset](https://www4.stat.ncsu.edu/~boos/var.select/diabetes.html). This dataset contains 10 baseline variables: age, sex, body mass index, average blood pressure, and 6 blood serum measurements obtained from 442 diabetes patients. It also contains the response of interest, a quantitative measure of disease progression one year after the date of the baseline data.
76+
The example in this article shows you how to deploy an MLflow model to an online endpoint to perform predictions. The example uses an MLflow model that's based on the [Diabetes dataset](https://www4.stat.ncsu.edu/~boos/var.select/diabetes.html). This dataset contains 10 baseline variables: age, sex, body mass index, average blood pressure, and 6 blood serum measurements obtained from 442 diabetes patients. It also contains the response of interest, a quantitative measure of disease progression one year after the date of the baseline data.
7777

78-
The model was trained by using a `scikit-learn` regressor. All the required preprocessing has been packaged as a pipeline, so this model is an end-to-end pipeline that goes from raw data to predictions.
78+
The model was trained by using a `scikit-learn` regressor. All the required preprocessing is packaged as a pipeline, so this model is an end-to-end pipeline that goes from raw data to predictions.
7979

80-
The information in this article is based on code samples from the [azureml-examples](https://github.com/azure/azureml-examples) repository. To run the commands locally without having to copy or paste YAML files and other files, use the following commands to clone the repository and go to the folder for your coding language:
80+
The information in this article is based on code samples from the [azureml-examples](https://github.com/azure/azureml-examples) repository. If you clone the repository, you can run the commands in this article locally without having to copy or paste YAML files and other files. Use the following commands to clone the repository and go to the folder for your coding language:
8181

8282
# [Azure CLI](#tab/cli)
8383

@@ -141,9 +141,9 @@ az configure --defaults workspace=<workspace-name> group=<resource-group-name> l
141141
1. Configure workspace details and get a handle to the workspace:
142142

143143
```python
144-
subscription_id = "<subscription>"
145-
resource_group = "<resource-group>"
146-
workspace = "<workspace>"
144+
subscription_id = "<subscription-ID>"
145+
resource_group = "<resource-group-name>"
146+
workspace = "<workspace-name>"
147147

148148
ml_client = MLClient(DefaultAzureCredential(), subscription_id, resource_group, workspace)
149149
```
@@ -181,7 +181,7 @@ Go to [Azure Machine Learning studio](https://ml.azure.com).
181181

182182
### Register the model
183183

184-
You can deploy only registered models to online endpoints. The steps in this article use a model that's trained for the [Diabetes dataset](https://www4.stat.ncsu.edu/~boos/var.select/diabetes.html). In this case, you already have a local copy of the model in the repository, so you only need to publish the model to the registry in the workspace. You can skip this step if the model you want to deploy is already registered.
184+
You can deploy only registered models to online endpoints. The steps in this article use a model that's trained for the [Diabetes dataset](https://www4.stat.ncsu.edu/~boos/var.select/diabetes.html). In this case, you already have a local copy of the model in your cloned repository, so you only need to publish the model to the registry in the workspace. You can skip this step if the model you want to deploy is already registered.
185185

186186
# [Azure CLI](#tab/cli)
187187

@@ -218,7 +218,7 @@ To create a model in Azure Machine Learning studio:
218218

219219
1. In the studio, select __Models__.
220220

221-
1. Select __Register__, and then select where your model is located. For this example, select __From local files__.
221+
1. Select __Register__, and then select the location of your model. For this example, select __From local files__.
222222

223223
1. On the __Upload model__ page, under __Model type__, select __MLflow__.
224224

@@ -239,19 +239,19 @@ If your model was logged inside a run, you can register it directly.
239239
To register the model, you need to know its storage location:
240240

241241
- If you use the MLflow `autolog` feature, the path to the model depends on the model type and framework. Check the job output to identify the name of the model folder. This folder contains a file named MLModel.
242-
- If you use the `log_model` method to manually log your models, you pass the path to the model as the argument to the method. For example, if you use `mlflow.sklearn.log_model(my_model, "classifier")` to log the model, the path that the model is stored on is called `classifier`.
242+
- If you use the `log_model` method to manually log your models, you pass the path to the model as an argument to that method. For example, if you use `mlflow.sklearn.log_model(my_model, "classifier")` to log the model, `classifier` is the path that the model is stored on.
243243

244244
# [Azure CLI](#tab/cli)
245245

246-
You can use the Azure Machine Learning CLI v2 to create a model from training job output. The following code uses the artifacts of a job with ID `$RUN_ID` to register a model named `$MODEL_NAME`. `$MODEL_PATH` is the path that the job used to store the model.
246+
You can use the Azure Machine Learning CLI v2 to create a model from training job output. The following code uses the artifacts of a job with ID `$RUN_ID` to register a model named `$MODEL_NAME`. `$MODEL_PATH` is the path that the job uses to store the model.
247247

248248
```bash
249249
az ml model create --name $MODEL_NAME --path azureml://jobs/$RUN_ID/outputs/artifacts/$MODEL_PATH
250250
```
251251

252252
# [Python (Azure Machine Learning SDK)](#tab/sdk)
253253

254-
You can use the Python SDK to create a model from training job output. The following code uses the artifacts of a job with ID `RUN_ID` to register a model named `sklearn-diabetes`. `MODEL_PATH` is the path that the job used to store the model.
254+
You can use the Python SDK to create a model from training job output. The following code uses the artifacts of a job with ID `RUN_ID` to register a model named `sklearn-diabetes`. `MODEL_PATH` is the path that the job uses to store the model.
255255

256256
```python
257257
model_name = 'sklearn-diabetes'
@@ -267,7 +267,7 @@ ml_client.models.create_or_update(
267267

268268
# [Python (MLflow SDK)](#tab/mlflow)
269269

270-
You can use the Python MLflow SDK to create a model from training job output. The following code uses the artifacts of a job with ID `RUN_ID` to register a model named `sklearn-diabetes`. `MODEL_PATH` is the path that the job used to store the model.
270+
You can use the Python MLflow SDK to create a model from training job output. The following code uses the artifacts of a job with ID `RUN_ID` to register a model named `sklearn-diabetes`. `MODEL_PATH` is the path that the job uses to store the model.
271271

272272
```python
273273
model_name = 'sklearn-diabetes'
@@ -292,7 +292,7 @@ version = registered_model.version
292292
1. Select __Next__.
293293

294294
1. On the __Model settings__ page, take the following steps:
295-
1. Under __Name__, enter the name you want to use for the registered model.
295+
1. Under __Name__, enter the name that you want to use for the registered model.
296296
1. Select __Next__.
297297

298298
1. On the __Review__ page, review the settings, and then select __Register__. A message appears about the model being created successfully.
@@ -333,7 +333,7 @@ version = registered_model.version
333333

334334
# [Python (MLflow SDK)](#tab/mlflow)
335335

336-
You can use a configuration file to configure the properties of this endpoint. In this case, you configure the authentication mode of the endpoint to be `key`.
336+
You can use a configuration file to configure the properties of the endpoint. In this case, you configure the authentication mode of the endpoint to be `key`.
337337

338338
```python
339339

@@ -457,7 +457,7 @@ version = registered_model.version
457457
---
458458

459459
> [!NOTE]
460-
> Automatic generation of the `scoring_script` and `environment` are only supported for the `pyfunc` model flavor. To use a different model flavor, see [Customize MLflow model deployments](#customize-mlflow-model-deployments).
460+
> Automatic generation of the `scoring_script` and `environment` is only supported for the `PyFunc` model flavor. To use a different model flavor, see [Customize MLflow model deployments](#customize-mlflow-model-deployments).
461461

462462
1. Create the deployment:
463463

@@ -515,7 +515,7 @@ version = registered_model.version
515515

516516
# [Azure CLI](#tab/cli)
517517

518-
This step isn't required in the Azure CLI if you use the `--all-traffic` flag during creation. If you need to change the traffic, you can use the `az ml online-endpoint update --traffic` command. For more information on how to update traffic, see [Progressively update the traffic](how-to-deploy-mlflow-models-online-progressive.md#progressively-update-the-traffic).
518+
This step isn't required in the Azure CLI if you use the `--all-traffic` flag during creation. If you need to change the traffic, you can use the `az ml online-endpoint update --traffic` command. For more information about how to update traffic, see [Progressively update the traffic](how-to-deploy-mlflow-models-online-progressive.md#progressively-update-the-traffic).
519519

520520
# [Python (Azure Machine Learning SDK)](#tab/sdk)
521521

@@ -547,7 +547,7 @@ version = registered_model.version
547547

548548
# [Azure CLI](#tab/cli)
549549

550-
This step isn't required in the Azure CLI if you use the `--all-traffic` flag during creation. If you need to change traffic, you can use the `az ml online-endpoint update --traffic` command. For more information on how to update traffic, see [Progressively update the traffic](how-to-deploy-mlflow-models-online-progressive.md#progressively-update-the-traffic).
550+
This step isn't required in the Azure CLI if you use the `--all-traffic` flag during creation. If you need to change traffic, you can use the `az ml online-endpoint update --traffic` command. For more information about how to update traffic, see [Progressively update the traffic](how-to-deploy-mlflow-models-online-progressive.md#progressively-update-the-traffic).
551551

552552
# [Python (Azure Machine Learning SDK)](#tab/sdk)
553553

@@ -572,7 +572,7 @@ version = registered_model.version
572572

573573
## Invoke the endpoint
574574

575-
When your deployment is ready, you can use it to serve requests. One way to test the deployment is by using the built-in invocation capability in the deployment client that you use. In the examples repository, the sample-request-sklearn.json file contains the following JSON code. You can use it as a sample request file for the deployment.
575+
When your deployment is ready, you can use it to serve requests. One way to test the deployment is by using the built-in invocation capability in your deployment client. In the examples repository, the sample-request-sklearn.json file contains the following JSON code. You can use it as a sample request file for the deployment.
576576

577577
# [Azure CLI](#tab/cli)
578578

@@ -593,7 +593,7 @@ When your deployment is ready, you can use it to serve requests. One way to test
593593
---
594594

595595
> [!NOTE]
596-
> This file uses the `input_data` key instead of `inputs`, which MLflow serving uses. Azure Machine Learning requires a different input format to be able to automatically generate the swagger contracts for the endpoints. For more information about expected input formats, see [Deployment in the MLflow built-in server vs. deployment in Azure Machine Learning inferencing server](how-to-deploy-mlflow-models.md#models-deployed-in-azure-machine-learning-vs-models-deployed-in-the-mlflow-built-in-server).
596+
> This file uses the `input_data` key instead of `inputs`, which MLflow serving uses. Azure Machine Learning requires a different input format to be able to automatically generate the Swagger contracts for the endpoints. For more information about expected input formats, see [Deployment in the MLflow built-in server vs. deployment in Azure Machine Learning inferencing server](how-to-deploy-mlflow-models.md#models-deployed-in-azure-machine-learning-vs-models-deployed-in-the-mlflow-built-in-server).
597597

598598
Submit a request to the endpoint:
599599

@@ -633,7 +633,7 @@ MLflow models can use the __Test__ tab to create invocations to the created endp
633633

634634
1. Select __Test__.
635635

636-
1. The box on the right displays the predictions.
636+
1. The output box displays the predictions.
637637

638638
---
639639

@@ -687,8 +687,8 @@ You typically want to customize your MLflow model deployment in the following ca
687687

688688
- The model doesn't have a `PyFunc` flavor.
689689
- You need to customize the way the model is run. For instance, you need to use `mlflow.<flavor>.load_model()` to use a specific flavor to load the model.
690-
- You need to do preprocessing or postprocessing in your scoring routine when it's not done by the model itself.
691-
- The output of the model can't be nicely represented in tabular data. For instance, it's a tensor representing an image.
690+
- You need to do preprocessing or postprocessing in your scoring routine, because the model doesn't do this processing.
691+
- The output of the model can't be nicely represented in tabular data. For instance, the output is a tensor that represents an image.
692692

693693
> [!IMPORTANT]
694694
> If you specify a scoring script for an MLflow model deployment, you also have to specify the environment that the deployment runs in.
@@ -707,7 +707,7 @@ Identify the folder that contains your MLflow model by taking the following step
707707

708708
1. Select the model that you want to deploy and go to its __Artifacts__ tab.
709709

710-
1. Take note of the folder that's displayed. You specified this folder when you registered the model.
710+
1. Take note of the folder that's displayed. When you register a model, you specify this folder.
711711

712712
:::image type="content" source="media/how-to-deploy-mlflow-models-online-endpoints/mlflow-model-folder-name.png" lightbox="media/how-to-deploy-mlflow-models-online-endpoints/mlflow-model-folder-name.png" alt-text="Screenshot that shows the folder that contains the model artifacts.":::
713713

@@ -722,7 +722,7 @@ The following scoring script, score.py, provides an example of how to perform in
722722

723723
#### Create an environment
724724

725-
The next step is to create an environment that you can run the scoring script in. Because the model is an MLflow model, the conda requirements are also specified in the model package. For more details about the files included in an MLflow model, see [The MLmodel format](concept-mlflow-models.md#the-mlmodel-format). You build the environment by using the conda dependencies from the file. However, you need to also include the `azureml-inference-server-http` package, which is required for online deployments in Azure Machine Learning.
725+
The next step is to create an environment that you can run the scoring script in. Because the model is an MLflow model, the conda requirements are also specified in the model package. For more information about the files included in an MLflow model, see [The MLmodel format](concept-mlflow-models.md#the-mlmodel-format). You build the environment by using the conda dependencies from the file. However, you need to also include the `azureml-inference-server-http` package, which is required for online deployments in Azure Machine Learning.
726726

727727
You can create a conda definition file named conda.yaml that contains the following lines:
728728

@@ -757,9 +757,9 @@ This operation isn't supported in the MLflow SDK.
757757
1. Go to the __Custom environments__ tab, and then select __Create__.
758758

759759
1. On the __Settings__ page, take the following steps:
760-
1. Under __Name__, enter the name of the environment. In this case, enter **sklearn-mlflow-online-py37**.
760+
1. Under __Name__, enter the name of the environment. In this case, enter __sklearn-mlflow-online-py37__.
761761
1. Under __Select environment source__, select __Use existing docker image with optional conda file__.
762-
1. Under __Container registry image path__, enter **mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu22.04**.
762+
1. Under __Container registry image path__, enter __mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu22.04__.
763763
1. Select __Next__ to go to the __Customize__ section.
764764

765765
1. Copy the contents of the sklearn-diabetes/environment/conda.yaml file and paste it in the text box.
@@ -837,13 +837,13 @@ To create the deployment, take the steps in the following sections.
837837

838838
1. Enter a name and authentication type for the endpoint, and then select __Next__.
839839

840-
1. Check to see that the model you selected is being used for your deployment, and then select __Next__ to continue to the ___Deployment__ page.
840+
1. Check to see that the model you selected is being used for your deployment, and then select __Next__ to continue to the __Deployment__ page.
841841

842842
1. Select __Next__.
843843

844844
##### Configure custom settings
845845

846-
1. On the __Code and environment for inferencing__ page, next to __Customize environment and scoring script__, select the slider. When you select a model that's registered in MLflow format, you don't need to specify a scoring script or an environment. But in this case, you want to specify both.
846+
1. On the __Code and environment for inferencing__ page, next to __Customize environment and scoring script__, select the slider. When you use a model that's registered in MLflow format, you don't need to specify a scoring script or an environment. But in this case, you want to specify both.
847847

848848
:::image type="content" source="media/how-to-deploy-mlflow-models-online-endpoints/configure-scoring-script-mlflow.png" lightbox="media/how-to-deploy-mlflow-models-online-endpoints/configure-scoring-script-mlflow.png" alt-text="Screenshot of a studio configuration page. Highlighted components include an option for customizing the environment and scoring script.":::
849849

@@ -911,7 +911,7 @@ This operation isn't supported in the MLflow SDK.
911911

912912
1. Select __Test__.
913913

914-
1. The box on the right displays the predictions.
914+
1. The output box displays the predictions.
915915

916916
---
917917

@@ -987,7 +987,7 @@ deployment_client.delete_endpoint(endpoint_name)
987987

988988
1. Select the endpoint that you want to delete.
989989

990-
1. Select __Delete__. The endpoint and all its deployments are deleted.
990+
1. Select __Delete__. The endpoint and its deployments are deleted.
991991

992992
---
993993

articles/machine-learning/includes/mlflow-model-package-for-workspace-without-egress.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
author: msakande
33
ms.service: azure-machine-learning
44
ms.topic: include
5-
ms.date: 10/04/2023
5+
ms.date: 01/24/2025
66
ms.author: mopeakande
77
---
88

0 commit comments

Comments
 (0)