ModelPackage Class

Note

This is an experimental class, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.

Model package.

Constructor

ModelPackage(*, target_environment: str | Dict[str, str], inferencing_server: AzureMLOnlineInferencingServer | AzureMLBatchInferencingServer, base_environment_source: BaseEnvironment | None = None, environment_variables: Dict[str, str] | None = None, inputs: List[ModelPackageInput] | None = None, model_configuration: ModelConfiguration | None = None, tags: Dict[str, str] | None = None, **kwargs: Any)

Parameters

Name Description
target_environment_name
Required
str

The target environment name for the model package.

target_environment_version
Required

The version of the model package.

Keyword-Only Parameters

Name Description
inferencing_server

The inferencing server of the model package.

base_environment_source

The base environment source of the model package.

Default value: None
environment_variables

The environment variables of the model package.

Default value: None
inputs

The inputs of the model package.

Default value: None
model_configuration

The model configuration.

Default value: None
tags

The tags of the model package.

Default value: None
target_environment
Required

Examples

Create a Model Package object.


   from azure.ai.ml.entities import AzureMLOnlineInferencingServer, CodeConfiguration, ModelPackage

   modelPackage = ModelPackage(  # type:ignore
       inferencing_server=AzureMLOnlineInferencingServer(
           code_configuration=CodeConfiguration(code="../model-1/foo/", scoring_script="score.py")
       ),
       target_environment_name="env-name",
       target_environment_version="1.0",
       environment_variables={"env1": "value1", "env2": "value2"},
       tags={"tag1": "value1", "tag2": "value2"},
   )

Methods

dump

Dumps the job content into a file in YAML format.

dump

Dumps the job 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.