Model Class

Model for training and scoring.

Constructor

Model(*, name: str | None = None, version: str | None = None, type: str | None = None, path: str | PathLike | None = None, utc_time_created: str | None = None, flavors: Dict[str, Dict[str, Any]] | None = None, description: str | None = None, tags: Dict | None = None, properties: Dict | None = None, stage: str | None = None, default_deployment_template: DeploymentTemplateReference | None = None, allowed_deployment_templates: List[DeploymentTemplateReference] | None = None, **kwargs: Any)

Parameters

Name Description
kwargs
Required

A dictionary of additional configuration parameters.

Keyword-Only Parameters

Name Description
name

The name of the model. Defaults to a random GUID.

Default value: None
version

The version of the model. Defaults to "1" if either no name or an unregistered name is provided. Otherwise, defaults to autoincrement from the last registered version of the model with that name.

Default value: None
type

The storage format for this entity, used for NCD (Novel Class Discovery). Accepted values are "custom_model", "mlflow_model", or "triton_model". Defaults to "custom_model".

Default value: None
utc_time_created

The date and time when the model was created, in UTC ISO 8601 format. (e.g. '2020-10-19 17:44:02.096572').

Default value: None
flavors

The flavors in which the model can be interpreted. Defaults to None.

Default value: None
path

A remote uri or a local path pointing to a model. Defaults to None.

Default value: None
description

The description of the resource. Defaults to None

Default value: None
tags

Tag dictionary. Tags can be added, removed, and updated. Defaults to None.

Default value: None
properties

The asset property dictionary. Defaults to None.

Default value: None
stage

The stage of the resource. Defaults to None.

Default value: None
default_deployment_template

The default deployment template reference for the model. Defaults to None.

Default value: None
allowed_deployment_templates

List of allowed deployment template references for the model.

Default value: None

Examples

Creating a Model object.


   from azure.ai.ml.entities import Model

   model = Model(
       name="model1",
       version="5",
       description="my first model in prod",
       path="models/very_important_model.pkl",
       properties={"prop1": "value1", "prop2": "value2"},
       type="mlflow_model",
       flavors={
           "sklearn": {"sklearn_version": "0.23.2"},
           "python_function": {"loader_module": "office.plrmodel", "python_version": 3.6},
       },
       stage="Production",
   )
   ml_client.models.create_or_update(model)

Methods

dump

Dump the asset content into a file in YAML format.

dump

Dump the asset content into a file in YAML format.

dump(dest: str | PathLike | IO, **kwargs: Any) -> None

Parameters

Name Description
dest
Required
Union[<xref:PathLike>, str, IO[AnyStr]]

The local path or file stream to write the YAML content to. If dest is a file path, a new file will be created. If dest is an open file, the file will be written to directly.

Exceptions

Type Description

Raised if dest is a file path and the file already exists.

Raised if dest is an open file and the file is not writable.

Attributes

base_path

The base path of the resource.

Returns

Type Description
str

The base path of the resource.

creation_context

The creation context of the resource.

Returns

Type Description

The creation metadata for the resource.

id

The resource ID.

Returns

Type Description

The global ID of the resource, an Azure Resource Manager (ARM) ID.

path

version

The asset version.

Returns

Type Description
str

The asset version.