Skip to content

Commit 64df693

Browse files
authored
Update how-to-log-view-metrics.md
1 parent 66fc49e commit 64df693

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

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

Lines changed: 14 additions & 8 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

@@ -183,14 +181,16 @@ client.log_batch(mlflow.active_run().info.run_id,
183181

184182
## Logging images
185183

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

188186
|Logged Value|Example code| Notes|
189187
|----|----|----|
190188
|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.|
191189
|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. |
192190

193-
## Logging other types of data
191+
## Logging files
192+
193+
In general, files in MLflow are called artifacts. You can log artifacts in multiple ways in Mlflow:
194194

195195
|Logged Value|Example code| Notes|
196196
|----|----|----|
@@ -199,12 +199,18 @@ MLflow supports two ways of logging images:
199199
|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. |
200200
|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. |
201201

202+
> [!TIP]
203+
> 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`.
204+
202205
## Logging models
203206

204207
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.
205208

206209
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).
207210

211+
> [!TIP]
212+
> 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`.
213+
208214
## Automatic logging
209215

210216
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).

0 commit comments

Comments
 (0)