Skip to content

Commit f2787ef

Browse files
committed
edits
1 parent 3ee0043 commit f2787ef

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

articles/machine-learning/how-to-use-mlflow-cli-runs.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Track experiments and models with MLflow
33
titleSuffix: Azure Machine Learning
4-
description: Use MLflow to log metrics and artifacts from machine learning runs.
4+
description: Learn how to use MLflow to log metrics and artifacts from machine learning experiments and runs in Azure Machine Learning workspaces.
55
author: msakande
66
ms.author: mopeakande
77
ms.reviewer: fasantia
@@ -11,12 +11,12 @@ ms.date: 09/25/2024
1111
ms.topic: how-to
1212
ms.custom: mlflow, devx-track-azurecli, cliv2, devplatv2, update-code, FY25Q1-Linter
1313
ms.devlang: azurecli
14-
#Customer intent: As a data scientist, I want to know how to track my machine learning experiments and models with MLflow so I can use MLflow for tracking.
14+
#Customer intent: As a data scientist, I want to know how to track my machine learning experiments and models with MLflow so I can use MLflow for tracking in Azure Machine Learning.
1515
---
1616

1717
# Track experiments and models with MLflow
1818

19-
In this article, you learn how to use MLflow for tracking experiments and runs in Azure Machine Learning workspaces. *Tracking* is the process of saving relevant information about experiments. The saved metadata varies by experiment, and can include:
19+
*Tracking* is the process of saving relevant information about experiments. In this article, you learn how to use MLflow for tracking experiments and runs in Azure Machine Learning workspaces. The saved metadata varies by experiment, and can include:
2020

2121
- Code
2222
- Environment details such as OS version and Python packages
@@ -29,7 +29,7 @@ In this article, you learn how to use MLflow for tracking experiments and runs i
2929

3030
When you work with jobs, Azure Machine Learning automatically tracks some information about experiments, such as code, environment, and input and output data. However, models, parameters, and metrics are specific to the scenario, so model builders must configure their tracking.
3131

32-
Whether you train with jobs in Azure Machine Learning or interactively in notebooks, experiment tracking helps you:
32+
Whether you train models with jobs in Azure Machine Learning or interactively in notebooks, experiment tracking helps you:
3333

3434
- Organize all of your machine learning experiments in a single place. You can then search and filter experiments and drill down to see details about previous experiments.
3535
- Easily compare experiments, analyze results, and debug model training.
@@ -40,7 +40,7 @@ Whether you train with jobs in Azure Machine Learning or interactively in notebo
4040
> - To track experiments running on Azure Databricks, see [Track Azure Databricks ML experiments with MLflow and Azure Machine Learning](how-to-use-mlflow-azure-databricks.md).
4141
> - To track experiments running on Azure Synapse Analytics, see [Track Azure Synapse Analytics ML experiments with MLflow and Azure Machine Learning](how-to-use-mlflow-azure-synapse.md).
4242
43-
Azure Machine Learning workspaces are MLflow-compatible. This compatibility means you can use MLflow to track runs, metrics, parameters, and artifacts in the workspaces without needing to change your training routines or inject any cloud-specific syntax. For more information about supported MLflow and Azure Machine Learning functionalities, see [MLflow and Azure Machine Learning](concept-mlflow.md).
43+
Azure Machine Learning workspaces are MLflow-compatible. This compatibility means you can use MLflow to track runs, metrics, parameters, and artifacts in workspaces without needing to change your training routines or inject any cloud-specific syntax. For more information about supported MLflow and Azure Machine Learning functionalities, see [MLflow and Azure Machine Learning](concept-mlflow.md).
4444

4545
>[!NOTE]
4646
>Some methods available in the MLflow API might not be available when connected to Azure Machine Learning. For details about supported and unsupported operations, see [Support matrix for querying runs and experiments](how-to-track-experiments-mlflow.md#support-matrix-for-querying-runs-and-experiments).
@@ -53,7 +53,7 @@ Azure Machine Learning workspaces are MLflow-compatible. This compatibility mean
5353

5454
## Configure the experiment
5555

56-
MLflow organizes information in experiments and runs. Runs are called *jobs* in Azure Machine Learning. By default, runs are logged to an experiment named **Default** that's automatically created for you. You can configure the experiment to track.
56+
MLflow organizes information in experiments and runs, which are called *jobs* in Azure Machine Learning. By default, runs log to an automatically created experiment named **Default**, but you can configure which experiment to track.
5757

5858
# [Notebooks](#tab/interactive)
5959

@@ -74,11 +74,11 @@ To submit jobs by using the Azure Machine Learning CLI or SDK, set the experimen
7474

7575
## Configure the run
7676

77-
Azure Machine Learning tracks any training job in what MLflow calls a run. Use runs to capture all the processing that your job performs.
77+
Azure Machine Learning tracks training jobs in what MLflow calls runs. Use runs to capture all the processing that your job performs.
7878

7979
# [Notebooks](#tab/interactive)
8080

81-
When you work interactively, MLflow starts tracking your training routine as soon as you try to log information that requires an active run. For instance, if Mlflow's autologging functionality is enabled, MLflow tracking starts when you log a metric or parameter, or start a training cycle.
81+
When you work interactively, MLflow starts tracking your training routine as soon as you start to log information that requires an active run. For instance, if Mlflow's autologging functionality is enabled, MLflow tracking starts when you log a metric or parameter, or start a training cycle.
8282

8383
However, it's usually helpful to start the run explicitly, especially if you want to capture the total time for your experiment in the **Duration** field. To start the run explicitly, use `mlflow.start_run()`.
8484

@@ -112,31 +112,29 @@ with mlflow.start_run(run_name="hello-world-example") as run:
112112

113113
Azure Machine Learning jobs allow you to submit long-running training or inference routines as isolated and reproducible executions.
114114

115-
### Create a training routine
115+
### Create a training routine that has tracking
116116

117-
When you work with jobs, you typically place all your training logic as files inside a folder, such as *src*. One of the files is a Python file with your training code entry point. The following example shows a *hello_world.py* example:
117+
When you work with jobs, you typically place all your training logic as files inside a folder, such as *src*. One of the files is a Python file with your training code entry point.
118118

119-
:::code language="python" source="~/azureml-examples-main/cli/jobs/basics/src/hello-mlflow.py" highlight="9-10,12":::
119+
In your training routine, you can use the MLflow SDK to track any metric, parameter, artifacts, or models. For examples, see [Log metrics, parameters, and files with MLflow](how-to-log-view-metrics.md).
120120

121-
The previous code example doesn't use `mlflow.start_run()` but if used, MLflow reuses the current active run. Therefore, you don't need to remove the `mlflow.start_run()` line if you migrate code to Azure Machine Learning.
121+
The following example shows a *hello_world.py* training routine that adds logging:
122122

123-
### Add tracking to your routine
123+
:::code language="python" source="~/azureml-examples-main/cli/jobs/basics/src/hello-mlflow.py" highlight="9-10,12":::
124124

125-
Use the MLflow SDK to track any metric, parameter, artifacts, or models. For examples, see [Log metrics, parameters, and files with MLflow](how-to-log-view-metrics.md).
125+
The previous code example doesn't use `mlflow.start_run()` but if used, MLflow reuses the current active run. Therefore, you don't need to remove the `mlflow.start_run()` line if you migrate code to Azure Machine Learning.
126126

127127
### Ensure your job's environment has MLflow installed
128128

129-
All Azure Machine Learning curated environments already have MLflow installed. However, if you use a custom environment, create a *conda.yaml* file that has the dependencies you need, as follows:
129+
All Azure Machine Learning curated environments already have MLflow installed. However, if you use a custom environment, create a *conda.yaml* file that has the dependencies you need, and reference the environment in your job.
130130

131131
:::code language="yaml" source="~/azureml-examples-main/sdk/python/using-mlflow/deploy/environment/conda.yaml" highlight="7-8" range="1-12":::
132132

133133
Reference the environment in your job.
134134

135135
### Configure your job name
136136

137-
Use the Azure Machine Learning jobs parameter `display_name` to configure the name of the run. Make sure not to use `mlflow.start_run(run_name="")` inside your training routine.
138-
139-
1. Use the `display_name` property to configure the job.
137+
Use the Azure Machine Learning jobs parameter `display_name` to configure the name of the job. Make sure not to use `mlflow.start_run(run_name="")` inside your training routine.
140138

141139
# [Azure CLI](#tab/cli)
142140

@@ -162,12 +160,14 @@ Use the Azure Machine Learning jobs parameter `display_name` to configure the na
162160

163161
### Submit the job
164162

165-
The workspace is the top-level resource for Azure Machine Learning, providing a centralized place to work with the artifacts you create. Jobs that use MLflow and run on Azure Machine Learning automatically log any tracking information to the workspace. In this section, you connect to the workspace and do deployment tasks.
163+
The workspace is the top-level resource for Azure Machine Learning, providing a centralized place to work with the artifacts you create. Jobs that use MLflow and run on Azure Machine Learning automatically log any tracking information to the workspace. In this section, you connect to the workspace to do deployment tasks.
166164

167165
1. Connect to your Azure Machine Learning workspace.
168166

169167
# [Azure CLI](#tab/cli)
170168

169+
Open your terminal and enter the following code:
170+
171171
```azurecli
172172
az account set --subscription <subscription>
173173
az configure --defaults workspace=<workspace> group=<resource-group> location=<location>
@@ -198,7 +198,7 @@ The workspace is the top-level resource for Azure Machine Learning, providing a
198198

199199
# [Azure CLI](#tab/cli)
200200

201-
Use the Azure Machine Learning CLI to [submit your job](how-to-train-model.md). Open your terminal and enter the following code:
201+
Use the Azure Machine Learning CLI to [submit your job](how-to-train-model.md).
202202

203203
```azurecli
204204
az ml job create -f job.yml --web
@@ -234,10 +234,11 @@ The metrics and artifacts from MLflow logging are tracked in your workspace. You
234234
To view metrics and artifacts in the studio:
235235

236236
1. On the **Jobs** page in your workspace, find the experiment by name.
237+
1. On the experiment details page, select the **Metrics** tab.
237238
1. Select logged metrics to render charts on the right side. You can customize the charts by applying smoothing, changing the color, or plotting multiple metrics on a single graph. You can also resize and rearrange the layout.
238239
1. Once you create your desired view, save it for future use and share it with your teammates by using a direct link.
239240

240-
:::image type="content" source="media/how-to-log-view-metrics/metrics.png" alt-text="Screenshot of the metrics view." lightbox="media/how-to-log-view-metrics/metrics.png":::
241+
:::image type="content" source="media/how-to-log-view-metrics/metrics.png" alt-text="Screenshot of the metrics view that shows the list of metrics and the charts created from the metrics." lightbox="media/how-to-log-view-metrics/metrics.png":::
241242

242243
To access or query metrics, parameters, and artifacts programatically via the MLflow SDK, use [mlflow.get_run()](https://mlflow.org/docs/latest/python_api/mlflow.html#mlflow.get_run).
243244

articles/machine-learning/includes/machine-learning-mlflow-prereqs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ ms.author: fasantia
1717
1818
- Create an Azure Machine Learning workspace. To create a workspace, see [Create resources you need to get started](../quickstart-create-resources.md). Review the [access permissions](../how-to-assign-roles.md#mlflow-operations) you need to perform your MLflow operations in your workspace.
1919

20-
- To do remote tracking, that is track experiments running outside Azure Machine Learning, configure MLflow to point to the tracking URI of your Azure Machine Learning workspace. For more information on how to connect MLflow to your workspace, see [Configure MLflow for Azure Machine Learning](../how-to-use-mlflow-configure-tracking.md).
20+
- To do *remote tracking*, or track experiments running outside Azure Machine Learning, configure MLflow to point to the tracking URI of your Azure Machine Learning workspace. For more information on how to connect MLflow to your workspace, see [Configure MLflow for Azure Machine Learning](../how-to-use-mlflow-configure-tracking.md).
86 Bytes
Loading

0 commit comments

Comments
 (0)