Skip to content

Commit 48bc32a

Browse files
authored
Update how-to-use-mlflow-cli-runs.md
1 parent bfd1cf8 commit 48bc32a

File tree

1 file changed

+39
-28
lines changed

1 file changed

+39
-28
lines changed

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

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,6 @@ To track a run that is not running on Azure Machine Learning compute, you need t
5757
> 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.
5858
5959
1. Getting the Azure Machine Learning Tracking URI:
60-
61-
# [Bash](#tab/cli)
62-
63-
[!INCLUDE [cli v2](../../includes/machine-learning-cli-v2.md)]
64-
65-
1. Login and configure your workspace:
66-
67-
```bash
68-
az account set --subscription <subscription>
69-
az configure --defaults workspace=<workspace> group=<resource-group> location=<location>
70-
```
71-
72-
1. You can get the tracking URI using the `az ml workspace` command:
73-
74-
```bash
75-
MLFLOW_TRACKING_URI=$(az ml workspace show --query mlflow_tracking_uri | sed 's/"//g')
76-
```
7760

7861
# [Python](#tab/python)
7962

@@ -121,6 +104,25 @@ To track a run that is not running on Azure Machine Learning compute, you need t
121104
mlflow_tracking_uri = ml_client.workspaces.get(ml_client.workspace_name).mlflow_tracking_uri
122105
```
123106

107+
# [Azure CLI](#tab/cli)
108+
109+
[!INCLUDE [cli v2](../../includes/machine-learning-cli-v2.md)]
110+
111+
You can use the Azure ML CLI 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
124+
```
125+
124126
# [Studio](#tab/studio)
125127

126128
Use the Azure Machine Learning portal to get the tracking URI:
@@ -129,6 +131,7 @@ To track a run that is not running on Azure Machine Learning compute, you need t
129131
1. In the upper right corner, click on the name of your workspace to show the __Directory + Subscription + Workspace__ blade.
130132
1. Click on __View all properties in Azure Portal__.
131133
1. On the __Essentials__ section, you will find the property __MLflow tracking URI__.
134+
132135

133136
# [Manually](#tab/manual)
134137

@@ -148,14 +151,6 @@ To track a run that is not running on Azure Machine Learning compute, you need t
148151

149152
1. Configuring the tracking URI:
150153

151-
# [Using an environment variable](#tab/environ)
152-
153-
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.
154-
155-
```bash
156-
MLFLOW_TRACKING_URI=$(az ml workspace show --query mlflow_tracking_uri | sed 's/"//g')
157-
```
158-
159154
# [Using MLflow SDK](#tab/mlflow)
160155

161156
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.
@@ -166,24 +161,40 @@ To track a run that is not running on Azure Machine Learning compute, you need t
166161
mlflow.set_tracking_uri(mlflow_tracking_uri)
167162
```
168163

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')
170+
```
171+
169172
### Set experiment name
170173

171-
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).
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.
175+
176+
> [!TIP]
177+
> When submitting jobs using Azure ML CLI 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.
178+
179+
# [MLflow SDK](#tab/mlflow)
180+
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).
172182

173183
```Python
174184
experiment_name = 'experiment_with_mlflow'
175185
mlflow.set_experiment(experiment_name)
176186
```
177187

178-
> [!TIP]
179-
> When submitting jobs using Azure ML CLI 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)
180189

181190
You can also 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.
182191

183192
```bash
184193
export MLFLOW_EXPERIMENT_NAME="experiment_with_mlflow"
185194
```
186195

196+
---
197+
187198
### Start training job
188199

189200
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 API and begin logging your training job metrics.

0 commit comments

Comments
 (0)