az ml model
Note
This reference is part of the ml extension for the Azure CLI (version 2.15.0 or higher). The extension will automatically install the first time you run an az ml model command. Learn more about extensions.
Manage Azure ML models.
Azure ML models consist of the binary file(s) that represent a machine learning model and any corresponding metadata. These models can be used in endpoint deployments for real-time and batch inference.
Commands
| az ml model archive |
Archive a model. |
| az ml model create |
Create a model. |
| az ml model download |
Download all model-related files. |
| az ml model list |
List models in a workspace. |
| az ml model restore |
Restore an archived model. |
| az ml model show |
Show details for a model. |
| az ml model update |
Update a model. |
az ml model archive
Archive a model.
Archiving a model will hide it by default from list queries (az ml model list). You can still continue to reference and use an archived model in your workflows. You can archive either a model container or a specific model version. Archiving a model container will archive all versions of the model under that given name. You can restore an archived model using az ml model restore. If the entire model container is archived, you cannot restore individual versions of the model - you will need to restore the model container.
az ml model archive --name
--resource-group
--workspace-name
[--label]
[--version]
Examples
Archive a model container (archives all versions of that model)
az ml model archive --name my-model --resource-group my-resource-group --workspace-name my-workspace
Archive a specific model version
az ml model archive --name my-model --version 1 --resource-group my-resource-group --workspace-name my-workspace
Required Parameters
Name of the model.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.
Optional Parameters
Label of the model.
Version of the model.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az ml model create
Create a model.
Models can be created from a local file or directory. The created model will be tracked in the workspace under the specified name and version.
az ml model create --resource-group
--workspace-name
[--description]
[--file]
[--name]
[--path]
[--set]
[--tags]
[--type]
[--version]
Examples
Create a model from a YAML specification file
az ml model create --file model.yml --resource-group my-resource-group --workspace-name my-workspace
Create a model from a local folder using command options
az ml model create --name my-model --version 1 --path ./my-model --resource-group my-resource-group --workspace-name my-workspace
Required Parameters
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.
Optional Parameters
Description of the model.
Local path to the YAML file containing the Azure ML model specification. The YAML reference docs for model can be found at: https://aka.ms/ml-cli-v2-model-yaml-reference.
Name of the model.
Path to the model file(s). This can be either a local or a remote location. If specified, --name/-n and --version/-v must also be provided.
Update an object by specifying a property path and value to set. Example: --set property1.property2=.
Space-separated key-value pairs for the tags of the object.
Type of the model, allowed values are custom_model, mlflow_model and triton_model. The default type is custom_model.
Version of the model.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az ml model download
Download all model-related files.
The files will be downloaded into a folder named after the model's name.
az ml model download --name
--resource-group
--version
--workspace-name
[--download-path]
Examples
Download a model with the specified name and version
az ml model download --name my-model --version 1 --resource-group my-resource-group --workspace-name my-workspace
Download a model with the specified name and version, into a specified local path
az ml model download --name my-model --version 1 --download-path local_path --resource-group my-resource-group --workspace-name my-workspace
Required Parameters
Name of the model.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Version of the model.
Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.
Optional Parameters
Path to download the model files, defaults to the current working directory.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az ml model list
List models in a workspace.
az ml model list --resource-group
--workspace-name
[--archived-only]
[--include-archived]
[--max-results]
[--name]
Examples
List all the models in a workspace
az ml model list --resource-group my-resource-group --workspace-name my-workspace
List all the model versions for the specified name in a workspace
az ml model list --name my-model --resource-group my-resource-group --workspace-name my-workspace
List all the models in a workspace using --query argument to execute a JMESPath query on the results of commands.
az ml model list --query "[].{Name:name}" --output table --resource-group my-resource-group --workspace-name my-workspace
Required Parameters
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.
Optional Parameters
List archived models only.
List archived models and active models.
Max number of results to return.
Name of the model. If provided, all the model versions under this name will be returned.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az ml model restore
Restore an archived model.
When an archived model is restored, it will no longer be hidden from list queries (az ml model list). If an entire model container is archived, you can restore that archived container. This will restore all versions of the model under that given name. You cannot restore only a specific model version if the entire model container is archived - you will need to restore the entire container. If only an individual model version was archived, you can restore that specific version.
az ml model restore --name
--resource-group
--workspace-name
[--label]
[--version]
Examples
Restore an archived model container (restores all versions of that model)
az ml model restore --name my-model --resource-group my-resource-group --workspace-name my-workspace
Restore a specific archived model version
az ml model restore --name my-model --version 1 --resource-group my-resource-group --workspace-name my-workspace
Required Parameters
Name of the model.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.
Optional Parameters
Label of the model.
Version of the model.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az ml model show
Show details for a model.
az ml model show --name
--resource-group
--workspace-name
[--label]
[--version]
Examples
Show details for a model with the specified name and version
az ml model show --name my-model --version 1 --resource-group my-resource-group --workspace-name my-workspace
Required Parameters
Name of the model.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.
Optional Parameters
Label of the model.
Version of the model.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az ml model update
Update a model.
The 'description', and 'tags' properties can be updated.
az ml model update --name
--resource-group
--workspace-name
[--add]
[--force-string]
[--label]
[--remove]
[--set]
[--version]
Examples
Update a model's flavors
az ml model update --name my-model --version 1 --set flavors.python_function.python_version=3.8 --resource-group my-resource-group --workspace-name my-workspace
Required Parameters
Name of the model.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.
Optional Parameters
Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.
When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.
Label of the model.
Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.
Update an object by specifying a property path and value to set. Example: --set property1.property2=.
Version of the model.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
الملاحظات
إرسال الملاحظات وعرضها المتعلقة بـ