az ml model

Note

This reference is part of the ml extension for Azure CLI and requires 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 create

Create a model.

az ml model delete

Delete a model.

az ml model list

List models in a workspace.

az ml model show

Show details for a model.

az ml model update

Update a model.

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
                   [--datastore-name]
                   [--file]
                   [--local-path]
                   [--name]
                   [--set]
                   [--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 --local-path ./my-model --resource-group my-resource-group --workspace-name my-workspace

Required Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

Optional Parameters

--datastore-name -z

Name of the datastore to upload the model to.

--file -f

Local path to the YAML file containing the Azure ML model specification. --name/-n and --version/-v must be provided if YAML file is not having name and version.

--local-path -l

Path to the model file(s). This can be either a file or a directory. If specified, --name/-n and --version/-v must also be provided.

--name -n

Name of the model.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--version -v

Version of the model.

az ml model delete

Delete a model.

az ml model delete --name
                   --resource-group
                   --version
                   --workspace-name

Required Parameters

--name -n

Name of the model.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--version -v

Version of the model.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

az ml model list

List models in a workspace.

az ml model list --resource-group
                 --workspace-name
                 [--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

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

Optional Parameters

--max-results -r

Max number of results to return.

--name -n

Name of the model. If provided, all the model versions under this name will be returned.

az ml model show

Show details for a model.

az ml model show --name
                 --resource-group
                 --workspace-name
                 [--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

Show details for the latest version of a model with the specified name

az ml model show --name my-model --resource-group my-resource-group --workspace-name my-workspace

Required Parameters

--name -n

Name of the model.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

Optional Parameters

--version -v

Version of the model. If omitted, the latest version is shown.

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]
                   [--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 -n

Name of the model.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--workspace-name -w

Name of the Azure ML workspace. You can configure the default group using az configure --defaults workspace=<name>.

Optional Parameters

--add

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

--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--version -v

Version of the model.