Skip to content

Commit d9e4e0f

Browse files
Merge pull request #223520 from santiagxf/santiagxf/mlflow-patch
Update how-to-manage-models-mlflow.md
2 parents 44b3734 + 2285085 commit d9e4e0f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

articles/machine-learning/how-to-manage-models-mlflow.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ Azure Machine Learning supports MLflow for model management. This represents a c
2020

2121
[!INCLUDE [mlflow-prereqs](../../includes/machine-learning-mlflow-prereqs.md)]
2222

23+
* Some operations may be executed directly using the MLflow fluent API (`mlflow.<method>`). However, others may require to create an MLflow client, which allows to communicate with Azure Machine Learning in the MLflow protocol. You can create an `MlflowClient` object as follows. This tutorial will use the object `client` to refer to such MLflow client.
24+
25+
```python
26+
using mlflow
27+
28+
client = mlflow.tracking.MlflowClient()
29+
```
30+
2331
## Registering new models in the registry
2432

2533
### Creating models from an existing run
@@ -33,6 +41,9 @@ mlflow.register_model(f"runs:/{run_id}/{artifact_path}", model_name)
3341
> [!NOTE]
3442
> Models can only be registered to the registry in the same workspace where the run was tracked. Cross-workspace operations are not supported by the moment in Azure Machine Learning.
3543
44+
> [!TIP]
45+
> We recommend to register models from runs or using the method `mlflow.<flavor>.log_model` from inside the run as it keeps lineage from the job that generated the asset.
46+
3647
### Creating models from assets
3748

3849
If you have a folder with an MLModel MLflow model, then you can register it directly. There's no need for the model to be always in the context of a run. To do that you can use the URI schema `file://path/to/model` to register MLflow models stored in the local file system. Let's create a simple model using `Scikit-Learn` and save it in MLflow format in the local storage:
@@ -58,22 +69,11 @@ model_local_path = os.path.abspath("./regressor")
5869
mlflow.register_model(f"file://{model_local_path}", "local-model-test")
5970
```
6071

61-
> [!NOTE]
62-
> Notice how the model URI schema `file:/` requires absolute paths.
63-
6472
## Querying model registries
6573

6674
### Querying all the models in the registry
6775

68-
You can query all the registered models in the registry using the MLflow client with the method `list_registered_models`. The MLflow client is required to do all these operations.
69-
70-
```python
71-
using mlflow
72-
73-
client = mlflow.tracking.MlflowClient()
74-
```
75-
76-
The following sample prints all the model's names:
76+
You can query all the registered models in the registry using the MLflow client. The following sample prints all the model's names:
7777

7878
```python
7979
for model in client.search_registered_models():

0 commit comments

Comments
 (0)