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
@@ -51,115 +51,150 @@ Tracking using MLflow with Azure Machine Learning lets you store the logged metr
51
51
52
52
### Set up tracking environment
53
53
54
-
To track a run that is not running on Azure Machine Learning compute (from now on referred to as *"local compute"*), you need to point your local compute to the Azure Machine Learning MLflow Tracking URI.
55
-
54
+
To track a run that is not running on Azure Machine Learning compute, you need to point MLflow to the Azure Machine Learning MLflow Tracking URI.
56
55
57
56
> [!NOTE]
58
57
> When running on Azure Compute (Azure Notebooks, Jupyter Notebooks hosted on Azure Compute Instances or Compute Clusters) you don't have to configure the tracking URI. It's automatically configured for you.
You can get the Azure ML MLflow tracking URI using the [Azure Machine Learning SDK v2 for Python](concept-v2.md). Ensure you have the library `azure-ai-ml` installed in the cluster you are using. The following sample gets the unique MLFLow tracking URI associated with your workspace. Then the method [`set_tracking_uri()`](https://mlflow.org/docs/latest/python_api/mlflow.html#mlflow.set_tracking_uri) points the MLflow tracking URI to that URI.
You can get the Azure ML MLflow tracking URI using the [Azure Machine Learning SDK v2 for Python](concept-v2.md). Ensure you have the library `azure-ai-ml` installed in the compute you are using. The following sample gets the unique MLFLow tracking URI associated with your workspace.
66
+
67
+
1. Login into your workspace using the `MLClient`. The easier way to do that is by using the workspace config file:
>`DefaultAzureCredential` will try to pull the credentials from the available context. If you want to specify credentials in a different way, for instance using the web browser in an interactive way, you can use `InteractiveBrowserCredential`orany other method available in`azure.identity` package.
You can use the Azure MLCLI v2 to get the MLflow tracking URI.
112
+
113
+
1. Login and configure your workspace:
114
+
115
+
```bash
116
+
az account set--subscription <subscription>
117
+
az configure --defaults workspace=<workspace> group=<resource-group> location=<location>
118
+
```
119
+
120
+
1. You can get the tracking URI using the `az ml workspace` command:
121
+
122
+
```bash
123
+
az ml workspace show --query mlflow_tracking_uri
76
124
```
77
125
78
-
> [!TIP]
79
-
> You can download the workspace configuration file by:
80
-
>1. Navigate to [Azure ML studio](https://ml.azure.com)
81
-
>2. Click on the uper-right corner of the page -> Download config file.
82
-
>3. Save the file`config.json`in the same directory where you are working on.
83
-
84
-
1. Using the subscription ID, resource group name and workspace name:
85
-
86
-
```Python
87
-
from azure.ai.ml import MLClient
88
-
from azure.identity import DefaultAzureCredential
89
-
import mlflow
126
+
# [Studio](#tab/studio)
127
+
128
+
Use the Azure Machine Learning portal to get the tracking URI:
129
+
130
+
1. Open the [Azure Machine Learning studio portal](https://ml.azure.com) and log in using your credentials.
131
+
1. In the upper right corner, click on the name of your workspace to show the __Directory + Subscription + Workspace__ blade.
132
+
1. Click on __View all properties in Azure Portal__.
133
+
1. On the __Essentials__ section, you will find the property __MLflow tracking URI__.
90
134
91
-
#Enter details of your AzureML workspace
135
+
136
+
# [Manually](#tab/manual)
137
+
138
+
The Azure Machine Learning Tracking URI can be constructed using the subscription ID, region of where the resource is deployed, resource group name and workspace name. The following code sample shows how:
139
+
140
+
> [!WARNING]
141
+
> If you are working in a private link-enabled workspace, the MLflow endpoint will also use a private link to communicate with Azure Machine Learning. As a consequence, the tracking URI will look different as proposed here. On those cases, you need to get the tracking URI using the Azure MLSDKorCLI v2.
>`DefaultAzureCredential` will try to pull the credentials from the available context. If you want to specify credentials in a different way, for instance using the web browser in an interactive way, you can use `InteractiveBrowserCredential`orany other method available in`azure.identity` package.
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.
152
+
1. Configuring the tracking URI:
112
153
113
-
```Azure CLI
114
-
export MLFLOW_TRACKING_URI=$(az ml workspace show --query mlflow_tracking_uri | sed 's/"//g')
115
-
```
116
-
117
-
>[!IMPORTANT]
118
-
> Make sure you are logged in to your Azure account on your local machine, otherwise the tracking URI returns an empty string. If you are using any Azure ML compute the tracking environment and experiment name is already configured.
119
-
120
-
# [Building the MLflow tracking URI](#tab/build)
121
-
122
-
The Azure Machine Learning Tracking URI can be constructed using the subscription ID, region of where the resource is deployed, resource group name and workspace name. The following code sample shows how:
123
-
124
-
125
-
```python
126
-
import mlflow
154
+
# [Using MLflow SDK](#tab/mlflow)
155
+
156
+
Then the method [`set_tracking_uri()`](https://mlflow.org/docs/latest/python_api/mlflow.html#mlflow.set_tracking_uri) points the MLflow tracking URI to that URI.
157
+
158
+
```python
159
+
import mlflow
160
+
161
+
mlflow.set_tracking_uri(mlflow_tracking_uri)
162
+
```
127
163
128
-
region=""
129
-
subscription_id=""
130
-
resource_group=""
131
-
workspace_name=""
164
+
# [Using an environment variable](#tab/environ)
165
+
166
+
You can set the MLflow environment variables [MLFLOW_TRACKING_URI](https://mlflow.org/docs/latest/tracking.html#logging-to-a-tracking-server) in your compute to make any interaction with MLflow in that compute to point by default to Azure Machine Learning.
167
+
168
+
```bash
169
+
MLFLOW_TRACKING_URI=$(az ml workspace show --query mlflow_tracking_uri | sed 's/"//g')
>1. Navigate to [Azure ML studio](https://ml.azure.com)
140
-
>2. Click on the uper-right corner of the page -> View all properties in Azure Portal -> MLflow tracking URI.
141
-
>3. Copy the URIand use it with the method `mlflow.set_tracking_uri`.
174
+
All MLflow runs are logged to the active experiment. By default, runs are logged to an experiment named `Default` that is automatically created for you. You can configure the experiment where tracking is happening.
142
175
143
-
---
176
+
> [!TIP]
177
+
> When submitting jobs using Azure MLCLI v2, you can set the experiment name using the property`experiment_name`in the YAML definition of the job. You don't have to configure it on your training script. See [YAML: display name, experiment name, description, and tags](reference-yaml-job-command.md#yaml-display-name-experiment-name-description-and-tags) for details.
144
178
145
-
### Set experiment name
179
+
# [MLflow SDK](#tab/mlflow)
146
180
147
-
All MLflow runs are logged to the active experiment. By default, runs are logged to an experiment named `Default` that is automatically created for you. To configure the experiment you want to work on use MLflow command [`mlflow.set_experiment()`](https://mlflow.org/docs/latest/python_api/mlflow.html#mlflow.set_experiment).
181
+
To configure the experiment you want to work on use MLflow command [`mlflow.set_experiment()`](https://mlflow.org/docs/latest/python_api/mlflow.html#mlflow.set_experiment).
148
182
149
183
```Python
150
184
experiment_name='experiment_with_mlflow'
151
185
mlflow.set_experiment(experiment_name)
152
186
```
153
187
154
-
> [!TIP]
155
-
> When submitting jobs using Azure MLCLI v2, you can set the experiment name using the property`experiment_name`in the YAML definition of the job. You don't have to configure it on your training script. See [YAML: display name, experiment name, description, and tags](reference-yaml-job-command.md#yaml-display-name-experiment-name-description-and-tags) for details.
188
+
# [Using an environment variable](#tab/environ)
156
189
157
190
You can also set one of the MLflow environment variables [MLFLOW_EXPERIMENT_NAMEorMLFLOW_EXPERIMENT_ID](https://mlflow.org/docs/latest/cli.html#cmdoption-mlflow-run-arg-uri) with the experiment name.
After you set the MLflow experiment name, you can start your training job with`start_run()`. Then use `log_metric()` to activate the MLflow logging APIand begin logging your training job metrics.
0 commit comments