You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this article, learn how to enable MLflow's tracking URI and logging API, collectively known as [MLflow Tracking](https://mlflow.org/docs/latest/quickstart.html#using-the-tracking-api), to connect Azure Machine Learning as the backend of your MLflow experiments. You can accomplish this connection with either the MLflow Python API or the [Azure Machine Learning CLI (v2)](how-to-train-cli.md). You also learn how to use [MLflow's Model Registry](https://mlflow.org/docs/latest/model-registry.html) capabilities with Azure Machine Learning.
21
20
22
-
[MLflow](https://www.mlflow.org) is an open-source library for managing the lifecycle of your machine learning experiments. MLFlow Tracking is a component of MLflow that logs and tracks your training run metrics and model artifacts, no matter your experiment's environment--locally on your computer, on a remote compute target, a virtual machine, or an [Azure Databricks cluster](how-to-use-mlflow-azure-databricks.md).
21
+
[MLflow](https://www.mlflow.org) is an open-source library for managing the lifecycle of your machine learning experiments. MLflow Tracking is a component of MLflow that logs and tracks your training run metrics and model artifacts, no matter your experiment's environment--locally on your computer, on a remote compute target, a virtual machine, or an [Azure Databricks cluster](how-to-use-mlflow-azure-databricks.md).
23
22
24
23
See [MLflow and Azure Machine Learning](concept-mlflow.md) for all supported MLflow and Azure Machine Learning functionality including MLflow Project support (preview) and model deployment.
25
24
@@ -35,18 +34,17 @@ See [MLflow and Azure Machine Learning](concept-mlflow.md) for all supported MLf
35
34
*[Create an Azure Machine Learning Workspace](how-to-manage-workspace.md).
36
35
* See which [access permissions you need to perform your MLflow operations with your workspace](how-to-assign-roles.md#mlflow-operations).
37
36
38
-
* Install and [set up CLI (v2)](how-to-configure-cli.md#prerequisites) and make sure you install the ml extension
37
+
* Install and [set up CLI (v2)](how-to-configure-cli.md#prerequisites) and make sure you install the ml extension.
MLflow Tracking with Azure Machine Learning lets you store the logged metrics and artifacts runs that were executed on your local machine into your Azure Machine Learning workspace.
43
44
44
45
### Set up tracking environment
45
46
46
-
To track a local run, you need to point your local machine to the Azure Machine Learning MLFlow Tracking URI.
47
-
48
-
>[!NOTE]
49
-
>The tracking URI is valid up to an hour or less. If you restart your script after some idle time, use the get_mlflow_tracking_uri API to get a new URI.
47
+
To track a local run, you need to point your local machine to the Azure Machine Learning MLflow Tracking URI.
50
48
51
49
# [MLflow](#tab/mlflow)
52
50
@@ -56,12 +54,21 @@ The following code uses `mlflow` and the [`subprocess`](https://docs.python.org/
56
54
import mlflow
57
55
import subprocess
58
56
59
-
#Get MLFLow UI through the Azure ML CLI (v2) and convert to string
57
+
#Get MLFLow URI through the Azure ML CLI (v2) and convert to string
Another option is to set one of the MLflow environment variables [MLFLOW_TRACKING_URI](https://mlflow.org/docs/latest/tracking.html#logging-to-a-tracking-server) directly in your terminal.
67
74
@@ -93,9 +100,9 @@ With MLflow you can use the [`mlflow.set_experiment()`](https://mlflow.org/docs/
93
100
with mlflow.start_run(experiment_id=experiment_name) as mlflow_run:
94
101
mlflow.log_param("hello_param", "world")
95
102
```
96
-
# [Azure CLI](#tab/azure-cli)
103
+
# [Azure CLI (v2)](#tab/azure-cli)
97
104
98
-
With the Azure CLI, set one of the MLflow environment variables [MLFLOW_EXPERIMENT_NAME or MLFLOW_EXPERIMENT_ID](https://mlflow.org/docs/latest/cli.html#cmdoption-mlflow-run-arg-uri) with the experiment name.
105
+
With the Azure CLI (v2), set one of the MLflow environment variables [MLFLOW_EXPERIMENT_NAME or MLFLOW_EXPERIMENT_ID](https://mlflow.org/docs/latest/cli.html#cmdoption-mlflow-run-arg-uri) with the experiment name.
99
106
100
107
```Azure CLI
101
108
# Configure MLflow to communicate with a Azure Machine Learning-hosted tracking server
@@ -120,6 +127,8 @@ with mlflow.start_run() as mlflow_run:
Remote runs (jobs) let you train your models on more powerful computes, such as GPU enabled virtual machines, or Machine Learning Compute clusters. See [Use compute targets for model training](how-to-set-up-training-targets.md) to learn about different compute options.
124
133
125
134
MLflow Tracking with Azure Machine Learning lets you store the logged metrics and artifacts from your remote runs into your Azure Machine Learning workspace. Any run with MLflow Tracking code in it logs metrics automatically to the workspace.
@@ -151,7 +160,7 @@ if __name__ == "__main__":
151
160
main()
152
161
```
153
162
154
-
Use the [Azure Machine Learning CLI (v2)](how-to-train-cli.md) to submit a run. When using the Azure Machine Learning CLI (v2), the MLflow tracking URI and experiment name are set automatically and directs the logging from MLflow to your workspace. Learn more about [logging Azure Machine Learning CLI (v2) experiments with MLflow](how-to-train-cli.md#model-tracking-with-mlflow)
163
+
Use the [Azure Machine Learning CLI (v2)](how-to-train-cli.md) to submit a remote run. When using the Azure Machine Learning CLI (v2), the MLflow tracking URI and experiment name are set automatically and directs the logging from MLflow to your workspace. Learn more about [logging Azure Machine Learning CLI (v2) experiments with MLflow](how-to-train-cli.md#model-tracking-with-mlflow)
155
164
156
165
Create a YAML file with your job definition in a `job.yml` file. This file should be created outside the `src` directory. Copy this code into the file:
157
166
@@ -179,10 +188,11 @@ az ml job create -f job.yml --web
179
188
180
189
The metrics and artifacts from MLflow logging are tracked in your workspace. To view them anytime, navigate to your workspace and find the experiment by name in your workspace in [Azure Machine Learning studio](https://ml.azure.com). Or run the below code.
181
190
182
-
Retrieve run metric using MLFlow[get_run()](https://mlflow.org/docs/latest/python_api/mlflow.html#mlflow.get_run).
191
+
Retrieve run metric using MLflow[get_run()](https://mlflow.org/docs/latest/python_api/mlflow.html#mlflow.get_run).
183
192
184
193
```Python
185
194
from mlflow.tracking import MlflowClient
195
+
186
196
# Use MlFlow to retrieve the run that was just completed
0 commit comments