- 1.63.0 (latest)
- 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: typing.Optional[str] = None,
predict_schemata: typing.Optional[
google.cloud.aiplatform.metadata.schema.utils.PredictSchemata
] = None,
artifact_id: typing.Optional[str] = None,
display_name: typing.Optional[str] = None,
schema_version: typing.Optional[str] = None,
description: typing.Optional[str] = None,
metadata: typing.Optional[typing.Dict] = None,
state: typing.Optional[
google.cloud.aiplatform_v1.types.artifact.Artifact.State
] = State.LIVE
)
An artifact representing a Vertex Experiment Model.
Properties
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: typing.Optional[str] = None,
predict_schemata: typing.Optional[
google.cloud.aiplatform.metadata.schema.utils.PredictSchemata
] = None,
artifact_id: typing.Optional[str] = None,
display_name: typing.Optional[str] = None,
schema_version: typing.Optional[str] = None,
description: typing.Optional[str] = None,
metadata: typing.Optional[typing.Dict] = None,
state: typing.Optional[
google.cloud.aiplatform_v1.types.artifact.Artifact.State
] = State.LIVE
)
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: typing.Optional[str] = None,
location: typing.Optional[str] = None,
credentials: typing.Optional[google.auth.credentials.Credentials] = None
) -> google.cloud.aiplatform.metadata.schema.google.artifact_schema.ExperimentModel
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() -> typing.Dict[str, typing.Any]
Get the model's info from an experiment model artifact.
load_model
load_model() -> typing.Union[sklearn.base.BaseEstimator, xgb.Booster, tf.Module]
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: typing.Optional[str] = None,
parent_model: typing.Optional[str] = None,
use_gpu: bool = False,
is_default_version: bool = True,
version_aliases: typing.Optional[typing.Sequence[str]] = None,
version_description: typing.Optional[str] = None,
display_name: typing.Optional[str] = None,
description: typing.Optional[str] = None,
labels: typing.Optional[typing.Dict[str, str]] = None,
serving_container_image_uri: typing.Optional[str] = None,
serving_container_predict_route: typing.Optional[str] = None,
serving_container_health_route: typing.Optional[str] = None,
serving_container_command: typing.Optional[typing.Sequence[str]] = None,
serving_container_args: typing.Optional[typing.Sequence[str]] = None,
serving_container_environment_variables: typing.Optional[
typing.Dict[str, str]
] = None,
serving_container_ports: typing.Optional[typing.Sequence[int]] = None,
instance_schema_uri: typing.Optional[str] = None,
parameters_schema_uri: typing.Optional[str] = None,
prediction_schema_uri: typing.Optional[str] = None,
explanation_metadata: typing.Optional[
google.cloud.aiplatform_v1.types.explanation_metadata.ExplanationMetadata
] = None,
explanation_parameters: typing.Optional[
google.cloud.aiplatform_v1.types.explanation.ExplanationParameters
] = None,
project: typing.Optional[str] = None,
location: typing.Optional[str] = None,
credentials: typing.Optional[google.auth.credentials.Credentials] = None,
encryption_spec_key_name: typing.Optional[str] = None,
staging_bucket: typing.Optional[str] = None,
sync: typing.Optional[bool] = True,
upload_request_timeout: typing.Optional[float] = None
) -> google.cloud.aiplatform.models.Model
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. |