Skip to content

Commit cd2ddc0

Browse files
Merge pull request #229617 from santiagxf/santiagxf/azureml-mlflow-largefiles
Update how-to-log-view-metrics.md
2 parents ddb6a0d + ec28e68 commit cd2ddc0

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

articles/machine-learning/how-to-log-view-metrics.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,11 @@ Logs can help you diagnose errors and warnings, or track performance metrics lik
4949
```
5050
* If you are doing remote tracking (tracking experiments running outside Azure Machine Learning), configure MLflow to track experiments using Azure Machine Learning. See [Configure MLflow for Azure Machine Learning](how-to-use-mlflow-configure-tracking.md) for more details.
5151

52-
## Getting started
52+
* To log metrics, parameters, artifacts and models in your experiments in Azure Machine Learning using MLflow, just import MLflow in your script:
5353

54-
To log metrics, parameters, artifacts and models in your experiments in Azure Machine Learning using MLflow, just import MLflow in your training script:
55-
56-
```python
57-
import mlflow
58-
```
54+
```python
55+
import mlflow
56+
```
5957

6058
### Configuring experiments
6159

@@ -150,9 +148,6 @@ params = {
150148
mlflow.log_params(params)
151149
```
152150

153-
> [!NOTE]
154-
> Azure Machine Learning SDK v1 logging can't log parameters. We recommend the use of MLflow for tracking experiments as it offers a superior set of features.
155-
156151
## Logging metrics
157152

158153
Metrics, as opposite to parameters, are always numeric. The following table describes how to log specific numeric types:
@@ -183,14 +178,16 @@ client.log_batch(mlflow.active_run().info.run_id,
183178

184179
## Logging images
185180

186-
MLflow supports two ways of logging images:
181+
MLflow supports two ways of logging images. Both of them persists the given image as an artifact inside of the run.
187182

188183
|Logged Value|Example code| Notes|
189184
|----|----|----|
190185
|Log numpy metrics or PIL image objects|`mlflow.log_image(img, "figure.png")`| `img` should be an instance of `numpy.ndarray` or `PIL.Image.Image`. `figure.png` is the name of the artifact that will be generated inside of the run. It doesn't have to be an existing file.|
191186
|Log matlotlib plot or image file|` mlflow.log_figure(fig, "figure.png")`| `figure.png` is the name of the artifact that will be generated inside of the run. It doesn't have to be an existing file. |
192187

193-
## Logging other types of data
188+
## Logging files
189+
190+
In general, files in MLflow are called artifacts. You can log artifacts in multiple ways in Mlflow:
194191

195192
|Logged Value|Example code| Notes|
196193
|----|----|----|
@@ -199,12 +196,18 @@ MLflow supports two ways of logging images:
199196
|Log a trivial file already existing | `mlflow.log_artifact("path/to/file.pkl")`| Files are always logged in the root of the run. If `artifact_path` is provided, then the file is logged in a folder as indicated in that parameter. |
200197
|Log all the artifacts in an existing folder | `mlflow.log_artifacts("path/to/folder")`| Folder structure is copied to the run, but the root folder indicated is not included. |
201198

199+
> [!TIP]
200+
> When __loggiging large files__, you may encounter the error `Failed to flush the queue within 300 seconds`. Usually, it means the operation is timing out before the upload of the file is completed. Consider increasing the timeout value by adjusting the environment variable `AZUREML_ARTIFACTS_DEFAULT_VALUE`.
201+
202202
## Logging models
203203

204204
MLflow introduces the concept of "models" as a way to package all the artifacts required for a given model to function. Models in MLflow are always a folder with an arbitrary number of files, depending on the framework used to generate the model. Logging models has the advantage of tracking all the elements of the model as a single entity that can be __registered__ and then __deployed__. On top of that, MLflow models enjoy the benefit of [no-code deployment](how-to-deploy-mlflow-models.md) and can be used with the [Responsible AI dashboard](how-to-responsible-ai-dashboard.md) in studio. Read the article [From artifacts to models in MLflow](concept-mlflow-models.md) for more information.
205205

206206
To save the model from a training run, use the `log_model()` API for the framework you're working with. For example, [mlflow.sklearn.log_model()](https://mlflow.org/docs/latest/python_api/mlflow.sklearn.html#mlflow.sklearn.log_model). For more details about how to log MLflow models see [Logging MLflow models](how-to-log-mlflow-models.md) For migrating existing models to MLflow, see [Convert custom models to MLflow](how-to-convert-custom-model-to-mlflow.md).
207207

208+
> [!TIP]
209+
> When __loggiging large models__, you may encounter the error `Failed to flush the queue within 300 seconds`. Usually, it means the operation is timing out before the upload of the model artifacts is completed. Consider increasing the timeout value by adjusting the environment variable `AZUREML_ARTIFACTS_DEFAULT_VALUE`.
210+
208211
## Automatic logging
209212

210213
With Azure Machine Learning and MLflow, users can log metrics, model parameters and model artifacts automatically when training a model. Each framework decides what to track automatically for you. A [variety of popular machine learning libraries](https://mlflow.org/docs/latest/tracking.html#automatic-logging) are supported. [Learn more about Automatic logging with MLflow](https://mlflow.org/docs/latest/python_api/mlflow.html#mlflow.autolog).
@@ -216,7 +219,7 @@ mlflow.autolog()
216219
```
217220

218221
> [!TIP]
219-
> You can control what gets automatically logged wit autolog. For instance, if you indicate `mlflow.autolog(log_models=False)`, MLflow will log everything but models for you. Such control is useful in cases where you want to log models manually but still enjoy automatic logging of metrics and parameters. Also notice that some frameworks may disable automatic logging of models if the trained model goes behond specific boundaries. Such behavior depends on the flavor used and we recommend you to view they documentation if this is your case.
222+
> You can control what gets automatically logged with autolog. For instance, if you indicate `mlflow.autolog(log_models=False)`, MLflow will log everything but models for you. Such control is useful in cases where you want to log models manually but still enjoy automatic logging of metrics and parameters. Also notice that some frameworks may disable automatic logging of models if the trained model goes behond specific boundaries. Such behavior depends on the flavor used and we recommend you to view they documentation if this is your case.
220223
221224
## View jobs/runs information with MLflow
222225

0 commit comments

Comments
 (0)