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
Copy file name to clipboardExpand all lines: articles/machine-learning/how-to-manage-models.md
+33-35Lines changed: 33 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ You learn how to:
33
33
- An Azure subscription with a free or paid version of Azure Machine Learning. If you don't have an Azure subscription, [create a free account](https://azure.microsoft.com/free/) before you begin.
34
34
- An [Azure Machine Learning workspace](quickstart-create-resources.md#create-the-workspace).
35
35
36
-
To run the code samples in this article, or work with the Azure Machine Learning V2 CLI or Python Azure Machine Learning V2 SDK:
36
+
To run the code samples in this article, or work with the Azure Machine Learning V2 CLI or Python Azure Machine Learning V2 SDK, you also need:
37
37
38
38
# [Azure CLI](#tab/cli)
39
39
@@ -55,14 +55,14 @@ To run the code samples in this article, or work with the Azure Machine Learning
55
55
---
56
56
57
57
> [!NOTE]
58
-
> You can still use model assets from the v1 SDK or CLI. V2 provides full backward compatibility. All models registered with the v1 CLI or SDK are assigned the type `custom`.
58
+
> V2 provides full backward compatibility. You can still use model assets from the v1 SDK or CLI. All models registered with the v1 CLI or SDK are assigned the type `custom`.
[Model registration](concept-model-management-and-deployment.md) lets you store and version your models in your workspace in the Azure cloud. The model registry helps you organize and keep track of your trained models. You can register models as assets in Azure Machine Learning by using the Azure CLI, the Python SDK, or the Machine Learning studio UI.
64
64
65
-
### Supported paths
65
+
### Supported URI formats
66
66
67
67
To register a model, you need to specify a path that points to the data or job location. The following table shows the various data locations Azure Machine Learning supports, and the syntax for the `path` parameter:
68
68
@@ -77,7 +77,7 @@ To register a model, you need to specify a path that points to the data or job l
77
77
78
78
### Supported modes
79
79
80
-
When you run a job with model inputs or outputs, you can specify which of the following *modes* to use. For example, you can specify whether the model should be read-only mounted or downloaded to the compute target.
80
+
When you use models for inputs or outputs, you can specify one of the following *modes*. For example, you can specify whether the model should be read-only mounted or downloaded to the compute target.
81
81
82
82
-`ro_mount`: Mount the data to the compute target as read-only.
83
83
-`rw_mount`: Read-write mount the data.
@@ -134,10 +134,10 @@ The following code snippets cover how to register a model as an asset in Azure M
134
134
135
135
The workspace is the top-level resource for Azure Machine Learning, providing a centralized place to work with all the artifacts you create when you use Azure Machine Learning. In this section, you connect to your Azure Machine Learning workspace to create the registered model.
136
136
137
-
In the following code snippets, replace `<subscription-id>`, `<resource-group>`, `<workspace-name>`, and `<location>` placeholders with the values for your environment.
138
-
139
137
# [Azure CLI](#tab/cli)
140
138
139
+
In the following commands, replace `<subscription-id>`, `<workspace-name>`, `<resource-group>`, and `<location>` placeholders with the values for your environment.
140
+
141
141
```azurecli
142
142
az account set --subscription <subscription-id>
143
143
az configure --defaults workspace=<workspace-name> group=<resource-group> location=<location>
@@ -154,7 +154,7 @@ az configure --defaults workspace=<workspace-name> group=<resource-group> locati
154
154
from azure.identity import DefaultAzureCredential
155
155
```
156
156
157
-
1. Configure workspace details and get a handle to the workspace:
157
+
1. Configure workspace details and get a handle to the workspace. In the following code snippet, replace the `<subscription-id>`, `<resource-group>`, and`<workspace-name>` placeholders with the values for your environment.
158
158
159
159
```python
160
160
subscription_id = "<subscription-id>"
@@ -168,27 +168,27 @@ az configure --defaults workspace=<workspace-name> group=<resource-group> locati
168
168
169
169
### Create the registered model
170
170
171
-
To create a registered model, use the following code, depending on whether the model you want to register is on your local computer, on an Azure Machine Learning datastore, orfrom an Azure Machine Learning job.
171
+
To create the registered model, use the following instructions, depending on whether the model you want to register is on your local computer, on an Azure Machine Learning datastore, orfrom an Azure Machine Learning job.
172
172
173
173
#### Local file or folder
174
174
175
175
# [Azure CLI](#tab/cli)
176
176
177
-
1. Create a YAMLfile*\<yaml-filename>.yml*. In the file, provide a name for your registered model, a path to the local model file, and a description. For example:
177
+
1. Create a YAMLfile*\<file-name>.yml*. In the file, provide a name for your registered model, a path to the local model file, and a description. For example:
@@ -256,24 +254,25 @@ If your model data comes from a job output, you have two options. You can use th
256
254
---
257
255
-**azureml://jobs URIformat**
258
256
259
-
The `azureml://jobs` reference URI option lets you register a model from artifacts in any of the job's outputs. This format aligns with the `azureml://datastores` reference URI format, and also supports referencing artifacts from named outputs other than the default artifact location.
257
+
The `azureml://jobs` reference URI option lets you register a model from artifacts inany of the job's output paths. This format aligns with the `azureml://datastores` reference URI format, and also supports referencing artifacts from named outputs other than the default artifact location.
260
258
261
259
If you didn't directly register your model within the training script by using MLflow, you can use this option to establish a lineage between a registered model and the job it was trained from.
- Default artifact location: `azureml://jobs/<run-id>/outputs/artifacts/paths/<path-to-model>/`. This location is equivalent to MLflow `runs:/<run-id>/<model>/`.
267
264
- Named output folder: `azureml://jobs/<run-id>/outputs/<named-output-folder>`
268
265
- Specific file within the named output folder: `azureml://jobs/<run-id>/outputs/<named-output-folder>/paths/<model-filename>`
269
266
- Specific folder path within the named output folder: `azureml://jobs/<run-id>/outputs/<named-output-folder>/paths/<model-folder-name>/`
270
267
268
+
For example:
269
+
271
270
# [Azure CLI](#tab/cli)
272
271
273
272
Save a model from a named output folder:
274
273
275
274
```azurecli
276
-
az ml model create --name <registered-model-name> --version 1 --path azureml://jobs/<run-id>/outputs/<model-folder-name>
275
+
az ml model create --name run-model-example--version 1--path azureml://jobs/<job_name>/outputs/artifacts/paths/model/
277
276
```
278
277
279
278
For a complete example, see the [CLI reference](/cli/azure/ml/model).
@@ -350,7 +349,7 @@ print(model_example)
350
349
Update mutable properties of a specific model:
351
350
352
351
> [!IMPORTANT]
353
-
> For models, only `description` and `tags` can be updated. All other properties are immutable. If you need to change any of those properties, you should create a new version of the model.
352
+
> For models, only `description`and`tags` can be updated. All other properties are immutable, andifyou need to change them, you should create a new version of the model.
Run the following code, substituting your input and output asset types and paths for the placeholders.
504
+
The following code creates an output that mounts your AzureML default datastore in read-write mode. The code simply loads the local MLflow model asinputandexports the same model as an output of the job saved in the mounted datastore.
506
505
507
506
```python
508
507
from azure.ai.ml import command
@@ -511,12 +510,11 @@ from azure.ai.ml import Input, Output
0 commit comments