- 1.73.0 (latest)
- 1.72.0
- 1.71.1
- 1.70.0
- 1.69.0
- 1.68.0
- 1.67.1
- 1.66.0
- 1.65.0
- 1.63.0
- 1.62.0
- 1.60.0
- 1.59.0
- 1.58.0
- 1.57.0
- 1.56.0
- 1.55.0
- 1.54.1
- 1.53.0
- 1.52.0
- 1.51.0
- 1.50.0
- 1.49.0
- 1.48.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.39.0
- 1.38.1
- 1.37.0
- 1.36.4
- 1.35.0
- 1.34.0
- 1.33.1
- 1.32.0
- 1.31.1
- 1.30.1
- 1.29.0
- 1.28.1
- 1.27.1
- 1.26.1
- 1.25.0
- 1.24.1
- 1.23.0
- 1.22.1
- 1.21.0
- 1.20.0
- 1.19.1
- 1.18.3
- 1.17.1
- 1.16.1
- 1.15.1
- 1.14.0
- 1.13.1
- 1.12.1
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.1
- 1.7.1
- 1.6.2
- 1.5.0
- 1.4.3
- 1.3.0
- 1.2.0
- 1.1.1
- 1.0.1
- 0.9.0
- 0.8.0
- 0.7.1
- 0.6.0
- 0.5.1
- 0.4.0
- 0.3.1
ExperimentModel(*, framework_name: str, framework_version: str, model_file: str, uri: str, model_class: Optional[str] = None, predict_schemata: Optional[google.cloud.aiplatform.metadata.schema.utils.PredictSchemata] = None, artifact_id: Optional[str] = None, display_name: Optional[str] = None, schema_version: Optional[str] = None, description: Optional[str] = None, metadata: Optional[Dict] = None, state: Optional[google.cloud.aiplatform_v1.types.artifact.Artifact.State] = <State.LIVE: 2>)
An artifact representing a Vertex Experiment Model.
Inheritance
builtins.object > google.cloud.aiplatform.base.VertexAiResourceNoun > builtins.object > google.cloud.aiplatform.base.FutureManager > google.cloud.aiplatform.base.VertexAiResourceNounWithFutureManager > builtins.object > abc.ABC > google.cloud.aiplatform.metadata.resource._Resource > google.cloud.aiplatform.metadata.artifact.Artifact > google.cloud.aiplatform.metadata.schema.base_artifact.BaseArtifactSchema > ExperimentModelProperties
framework_name
The framework name of the saved ML model.
framework_version
The framework version of the saved ML model.
model_class
The class name of the saved ML model.
Methods
ExperimentModel
ExperimentModel(*, framework_name: str, framework_version: str, model_file: str, uri: str, model_class: Optional[str] = None, predict_schemata: Optional[google.cloud.aiplatform.metadata.schema.utils.PredictSchemata] = None, artifact_id: Optional[str] = None, display_name: Optional[str] = None, schema_version: Optional[str] = None, description: Optional[str] = None, metadata: Optional[Dict] = None, state: Optional[google.cloud.aiplatform_v1.types.artifact.Artifact.State] = <State.LIVE: 2>)
Instantiates an ExperimentModel that represents a saved ML model.
Parameters | |
---|---|
Name | Description |
framework_name |
str
Required. The name of the model's framework. E.g., 'sklearn' |
framework_version |
str
Required. The version of the model's framework. E.g., '1.1.0' |
model_file |
str
Required. The file name of the model. E.g., 'model.pkl' |
uri |
str
Required. The uniform resource identifier of the model artifact directory. |
model_class |
str
Optional. The class name of the model. E.g., 'sklearn.linear_model._base.LinearRegression' |
predict_schemata |
PredictSchemata
Optional. An instance of PredictSchemata which holds instance, parameter and prediction schema uris. |
artifact_id |
str
Optional. The <resource_id> portion of the Artifact name with the format. This is globally unique in a metadataStore: projects/123/locations/us-central1/metadataStores/<metadata_store_id>/artifacts/<resource_id>. |
display_name |
str
Optional. The user-defined name of the Artifact. |
schema_version |
str
Optional. schema_version specifies the version used by the Artifact. If not set, defaults to use the latest version. |
description |
str
Optional. Describes the purpose of the Artifact to be created. |
metadata |
Dict
Optional. Contains the metadata information that will be stored in the Artifact. |
state |
google.cloud.gapic.types.Artifact.State
Optional. The state of this Artifact. This is a property of the Artifact, and does not imply or apture any ongoing process. This property is managed by clients (such as Vertex AI Pipelines), and the system does not prescribe or check the validity of state transitions. |
get
get(
artifact_id: str,
*,
metadata_store_id: str = "default",
project: Optional[str] = None,
location: Optional[str] = None,
credentials: Optional[google.auth.credentials.Credentials] = None
)
Retrieves an existing ExperimentModel artifact given an artifact id.
Parameters | |
---|---|
Name | Description |
artifact_id |
str
Required. An artifact id of the ExperimentModel artifact. |
metadata_store_id |
str
Optional. MetadataStore to retrieve Artifact from. If not set, metadata_store_id is set to "default". If artifact_id is a fully-qualified resource name, its metadata_store_id overrides this one. |
project |
str
Optional. Project to retrieve the artifact from. If not set, project set in aiplatform.init will be used. |
location |
str
Optional. Location to retrieve the Artifact from. If not set, location set in aiplatform.init will be used. |
credentials |
auth_credentials.Credentials
Optional. Custom credentials to use to retrieve this Artifact. Overrides credentials set in aiplatform.init. |
Exceptions | |
---|---|
Type | Description |
ValueError |
if artifact's schema title is not 'google.ExperimentModel'. |
get_model_info
get_model_info()
Get the model's info from an experiment model artifact.
load_model
load_model()
Retrieves the original ML model from an ExperimentModel.
Example Usage:
experiment_model = aiplatform.get_experiment_model("my-sklearn-model")
sk_model = experiment_model.load_model()
pred_y = model.predict(test_X)
Exceptions | |
---|---|
Type | Description |
ValueError |
if model type is not supported. |
register_model
register_model(
*,
model_id: Optional[str] = None,
parent_model: Optional[str] = None,
use_gpu: bool = False,
is_default_version: bool = True,
version_aliases: Optional[Sequence[str]] = None,
version_description: Optional[str] = None,
display_name: Optional[str] = None,
description: Optional[str] = None,
labels: Optional[Dict[str, str]] = None,
serving_container_image_uri: Optional[str] = None,
serving_container_predict_route: Optional[str] = None,
serving_container_health_route: Optional[str] = None,
serving_container_command: Optional[Sequence[str]] = None,
serving_container_args: Optional[Sequence[str]] = None,
serving_container_environment_variables: Optional[Dict[str, str]] = None,
serving_container_ports: Optional[Sequence[int]] = None,
instance_schema_uri: Optional[str] = None,
parameters_schema_uri: Optional[str] = None,
prediction_schema_uri: Optional[str] = None,
explanation_metadata: Optional[
google.cloud.aiplatform_v1.types.explanation_metadata.ExplanationMetadata
] = None,
explanation_parameters: Optional[
google.cloud.aiplatform_v1.types.explanation.ExplanationParameters
] = None,
project: Optional[str] = None,
location: Optional[str] = None,
credentials: Optional[google.auth.credentials.Credentials] = None,
encryption_spec_key_name: Optional[str] = None,
staging_bucket: Optional[str] = None,
sync: Optional[bool] = True,
upload_request_timeout: Optional[float] = None
)
Register an ExperimentModel to Model Registry and returns a Model representing the registered Model resource.
Example Usage:
experiment_model = aiplatform.get_experiment_model("my-sklearn-model")
registered_model = experiment_model.register_model()
registered_model.deploy(endpoint=my_endpoint)
Parameters | |
---|---|
Name | Description |
model_id |
str
Optional. The ID to use for the registered Model, which will become the final component of the model resource name. This value may be up to 63 characters, and valid characters are |
parent_model |
str
Optional. The resource name or model ID of an existing model that the newly-registered model will be a version of. Only set this field when uploading a new version of an existing model. |
use_gpu |
str
Optional. Whether or not to use GPUs for the serving container. Only specify this argument when registering a Tensorflow model and 'serving_container_image_uri' is not specified. |
is_default_version |
bool
Optional. When set to True, the newly registered model version will automatically have alias "default" included. Subsequent uses of this model without a version specified will use this "default" version. When set to False, the "default" alias will not be moved. Actions targeting the newly-registered model version will need to specifically reference this version by ID or alias. New model uploads, i.e. version 1, will always be "default" aliased. |
version_aliases |
Sequence[str]
Optional. User provided version aliases so that a model version can be referenced via alias instead of auto-generated version ID. A default version alias will be created for the first version of the model. The format is |
version_description |
str
Optional. The description of the model version being uploaded. |
display_name |
str
Optional. The display name of the Model. The name can be up to 128 characters long and can be consist of any UTF-8 characters. |
description |
str
Optional. The description of the model. |
labels |
Dict[str, str]
Optional. The labels with user-defined metadata to organize your Models. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels. |
serving_container_image_uri |
str
Optional. The URI of the Model serving container. A pre-built container https://cloud.google.com/vertex-ai/docs/predictions/pre-built-containers is automatically chosen based on the model's framwork. Set this field to override the default pre-built container. |
serving_container_predict_route |
str
Optional. An HTTP path to send prediction requests to the container, and which must be supported by it. If not specified a default HTTP path will be used by Vertex AI. |
serving_container_health_route |
str
Optional. An HTTP path to send health check requests to the container, and which must be supported by it. If not specified a standard HTTP path will be used by Vertex AI. |
serving_container_command |
Sequence[str]
Optional. The command with which the container is run. Not executed within a shell. The Docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. |
serving_container_args |
Sequence[str]
Optional. The arguments to the command. The Docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. |
serving_container_environment_variables |
Dict[str, str]
Optional. The environment variables that are to be present in the container. Should be a dictionary where keys are environment variable names and values are environment variable values for those names. |
serving_container_ports |
Sequence[int]
Optional. Declaration of ports that are exposed by the container. This field is primarily informational, it gives Vertex AI information about the network connections the container uses. Listing or not a port here has no impact on whether the port is actually exposed, any port listening on the default "0.0.0.0" address inside a container will be accessible from the network. |
instance_schema_uri |
str
Optional. Points to a YAML file stored on Google Cloud Storage describing the format of a single instance, which are used in |
parameters_schema_uri |
str
Optional. Points to a YAML file stored on Google Cloud Storage describing the parameters of prediction and explanation via |
prediction_schema_uri |
str
Optional. Points to a YAML file stored on Google Cloud Storage describing the format of a single prediction produced by this Model, which are returned via |
explanation_metadata |
aiplatform.explain.ExplanationMetadata
Optional. Metadata describing the Model's input and output for explanation. |
explanation_parameters |
aiplatform.explain.ExplanationParameters
Optional. Parameters to configure explaining for Model's predictions. For more details, see |
encryption_spec_key_name |
Optional[str]
Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the model. Has the form |
staging_bucket |
str
Optional. Bucket to stage local model artifacts. Overrides staging_bucket set in aiplatform.init. |
sync |
bool
Optional. Whether to execute this method synchronously. If False, this method will unblock and it will be executed in a concurrent Future. |
upload_request_timeout |
float
Optional. The timeout for the upload request in seconds. |
Exceptions | |
---|---|
Type | Description |
ValueError |
If the model doesn't have a pre-built container that is suitable for its framework and 'serving_container_image_uri' is not set. |
Returns | |
---|---|
Type | Description |
model (aiplatform.Model) |
Instantiated representation of the registered model resource. |