Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/machinelearningservices/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2025-12-19

### Azure Machine Learning CLI (v2) v 2.41.0
- `az ml model create`
- Add support for `default_deployment_template` parameter to associate a deployment template with a model.

## 2025-11-04

### Azure Machine Learning CLI (v2) v 2.40.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_model_help():
short-summary: Create a model.
long-summary: >
Models can be created from a local file, local directory, datastore or job outputs. The created model will be
tracked in the workspace/registry under the specified name and version. If you are using a registry, replace `--workspace-name my-workspace` with the `--registry-name <registry-name>` option.
tracked in the workspace/registry under the specified name and version. If you are using a registry, replace `--workspace-name my-workspace` with the `--registry-name my-registry` option.
examples:
- name: Create a model from a YAML specification file
text: az ml model create --file model.yml --resource-group my-resource-group --workspace-name my-workspace
Expand All @@ -40,6 +40,8 @@ def get_model_help():
text: az ml model create --name my-model --version 1 --path azureml://jobs/c42d2507-4953-4a7c-a4c1-2b5bfe0ac64e/outputs/artifacts/paths/model/ --resource-group my-resource-group --workspace-name my-workspace
- name: Create a model from a datastore 'azureml://datastores/<datastore-name>/paths/<path-to-model-relative-to-the-root-of-the-datastore-location>' using command options
text: az ml model create --name my-model --version 1 --path azureml://datastores/myblobstore/paths/models/cifar10/cifar.pt --resource-group my-resource-group --workspace-name my-workspace
- name: Create a model from a YAML file and override the default deployment template
text: az ml model create --registry-name my-registry --resource-group my-resource-group --file model.yaml --set default_deployment_template.asset_id="azureml://registries/my-registry/deploymenttemplates/my-template/versions/1" --version 3
"""
helps[
"ml model show"
Expand Down Expand Up @@ -83,7 +85,7 @@ def get_model_help():
type: command
short-summary: Update a model in a workspace/registry.
long-summary: >
The 'description', and 'tags' properties can be updated. If you are using a registry, replace `--workspace-name my-workspace` with the `--registry-name <registry-name>` option.
The 'description', and 'tags' properties can be updated. If you are using a registry, replace `--workspace-name my-workspace` with the `--registry-name my-registry` option.
examples:
- name: Update a model's flavors
text: 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# regenerated.
# --------------------------------------------------------------------------

from azure.ai.ml.constants._common import YAMLRefDocLinks

from ._common_params import (
add_common_params,
add_description_param,
Expand Down Expand Up @@ -60,7 +62,7 @@ def load_deployment_template_params(self):
# Optional for create since they can come from file
add_deployment_template_common_param(c, name_required=False, version_required=False)
add_lro_param(c)
add_file_param(c, "deployment-template", "https://aka.ms/ml-cli-v2-deployment-template-yaml")
add_file_param(c, "deployment-template", YAMLRefDocLinks.DEPLOYMENT_TEMPLATE)
add_override_param(c)
c.argument(
"registry_name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ def load_model_params(self):
"The default type is custom_model.",
)
add_description_param(c, help_message="Description of the model.")
c.argument(
"default_deployment_template",
options_list=["--default-deployment-template", "-d"],
help="Default deployment template for the model. Can be overridden using --set with the format: "
"--set default_deployment_template.asset_id="
"\"azureml://registries/my-registry/deploymenttemplates/template-name/versions/version\"",
)

with self.argument_context("ml model show") as c:
add_common_params(c)
Expand Down
4 changes: 4 additions & 0 deletions src/machinelearningservices/azext_mlv2/manual/custom/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def ml_model_create(
registry_name=None,
params_override=None,
datastore=None,
default_deployment_template=None,
no_wait=None, # pylint: disable=unused-argument
):
ml_client, debug = get_ml_client(
Expand All @@ -61,6 +62,8 @@ def ml_model_create(
params_override.append({"stage": stage})
if datastore:
params_override.append({"datastore": datastore})
if default_deployment_template:
params_override.append({"default_deployment_template": default_deployment_template})

model_info = ModelInfo()
try:
Expand All @@ -81,6 +84,7 @@ def ml_model_create(
stage=stage,
type=type,
datastore=datastore,
default_deployment_template=default_deployment_template,
)
if model and model.type:
model_info.model_type = model.type
Expand Down
Loading