google_cloud_pipeline_components.aiplatform package

Submodules

google_cloud_pipeline_components.aiplatform.utils module

Module for creating pipeline components based on AI Platform SDK.

google_cloud_pipeline_components.aiplatform.utils.convert_method_to_component(cls: google.cloud.aiplatform.base.VertexAiResourceNoun, method: Callable) Callable

Converts a MB SDK Method to a Component wrapper.

The wrapper enforces the correct signature w.r.t the MB SDK. The signature is also available to inspect.

For example:

aiplatform.Model.deploy is converted to ModelDeployOp

Which can be called:
model_deploy_step = ModelDeployOp(

project=project, # Pipeline parameter endpoint=endpoint_create_step.outputs[‘endpoint’], model=model_upload_step.outputs[‘model’], deployed_model_display_name=’my-deployed-model’, machine_type=’n1-standard-4’,

)

Generates and invokes the following Component:

name: Model-deploy inputs: - {name: project, type: String} - {name: endpoint, type: Artifact} - {name: model, type: Model} outputs: - {name: endpoint, type: Artifact} implementation:

container:

image: gcr.io/sashaproject-1/mb_sdk_component:latest command: - python3 - remote_runner.py - –cls_name=Model - –method_name=deploy - –method.deployed_model_display_name=my-deployed-model - –method.machine_type=n1-standard-4 args: - –resource_name_output_artifact_path - {outputPath: endpoint} - –init.project - {inputValue: project} - –method.endpoint - {inputPath: endpoint} - –init.model_name - {inputPath: model}

Args:

method (Callable): A MB SDK Method should_serialize_init (bool): Whether to also include the constructor params

in the component

Returns:

A Component wrapper that accepts the MB SDK params and returns a Task.

google_cloud_pipeline_components.aiplatform.utils.filter_docstring_args(signature: inspect.Signature, docstring: str, is_init_signature: bool = False) Dict[str, str]

Removes unused params from docstring Args section.

Args:

signature (inspect.Signature): Model Builder SDK Method Signature. docstring (str): Model Builder SDK Method docstring from method.__doc__ is_init_signature (bool): is this constructor signature

Returns:

Dictionary of Arg names as keys and descriptions as values.

google_cloud_pipeline_components.aiplatform.utils.filter_signature(signature: inspect.Signature, is_init_signature: bool = False, self_type: Optional[google.cloud.aiplatform.base.VertexAiResourceNoun] = None, component_param_name_to_mb_sdk_param_name: Optional[Dict[str, str]] = None) inspect.Signature

Removes unused params from signature.

Args:

signature (inspect.Signature): Model Builder SDK Method Signature. is_init_signature (bool): is this constructor signature self_type (aiplatform.base.VertexAiResourceNoun): This is used to

replace *_name str fields with resource name type.

component_param_name_to_mb_sdk_param_name dict[str, str]: Mapping to

keep track of param names changed to make them component friendly( ie: model_name -> model)

Returns:

Signature appropriate for component creation.

google_cloud_pipeline_components.aiplatform.utils.generate_docstring(args_dict: Dict[str, str], signature: inspect.Signature, method_docstring: str) str

Generates a new doc string using args_dict provided.

Args:

args_dict (Dict[str, str]): A dictionary of Arg names as keys and descriptions as values. signature (inspect.Signature): Method Signature of the converted method. method_docstring (str): Model Builder SDK Method docstring from method.__doc__

Returns:

A doc string for converted method.

google_cloud_pipeline_components.aiplatform.utils.get_deserializer(annotation: Any) Optional[Callable[[...], str]]

Get deserializer for objects to pass them as strings.

Remote runner will deserialize. # TODO handle proto.Message Args:

annotation: parameter annotation

Returns:

deserializer for annotation type

google_cloud_pipeline_components.aiplatform.utils.get_forward_reference(annotation: Any) Optional[google.cloud.aiplatform.base.VertexAiResourceNoun]

Resolves forward references to AiPlatform Class.

google_cloud_pipeline_components.aiplatform.utils.get_serializer(annotation: Any) Optional[Callable]

Get a serializer for objects to pass them as strings.

Remote runner will deserialize. # TODO handle proto.Message

Args:

annotation: Parameter annotation

Returns:

serializer for that annotation type

google_cloud_pipeline_components.aiplatform.utils.is_mb_sdk_resource_noun_type(mb_sdk_type: Any) bool

Determines if type passed in should be a metadata type.

Args:

mb_sdk_type: Type to check

Returns:

True if this is a resource noun

google_cloud_pipeline_components.aiplatform.utils.is_resource_name_parameter_name(param_name: str) bool

Determines if the mb_sdk parameter is a resource name.

google_cloud_pipeline_components.aiplatform.utils.is_serializable_to_json(annotation: Any) bool

Checks if the type is serializable.

Args:

annotation: parameter annotation

Returns:

True if serializable to json.

google_cloud_pipeline_components.aiplatform.utils.map_resource_to_metadata_type(mb_sdk_type: google.cloud.aiplatform.base.VertexAiResourceNoun) Tuple[str, str]

Maps an MB SDK type to Metadata type.

Returns:

Tuple of component parameter name and metadata type. ie aiplatform.Model -> “model”, “Model”

google_cloud_pipeline_components.aiplatform.utils.resolve_annotation(annotation: Any) Any

Resolves annotation type against a MB SDK type.

Use this for Optional, Union, Forward References

Args:

annotation: Annotation to resolve

Returns:

Direct annotation

google_cloud_pipeline_components.aiplatform.utils.should_be_metadata_type(mb_sdk_type: Any) bool

Determines if type passed in should be a metadata type.

google_cloud_pipeline_components.aiplatform.utils.signatures_union(init_sig: inspect.Signature, method_sig: inspect.Signature) inspect.Signature

Returns a Union of the constructor and method signature.

Args:

init_sig (inspect.Signature): Constructor signature method_sig (inspect.Signature): Method signature

Returns:

A Union of the the two Signatures as a single Signature

Module contents

Core modules for AI Platform Pipeline Components.

google_cloud_pipeline_components.aiplatform.AutoMLForecastingTrainingJobRunOp(display_name: str, dataset: google.cloud.aiplatform.datasets.time_series_dataset.TimeSeriesDataset, target_column: str, time_column: str, time_series_identifier_column: str, unavailable_at_forecast_columns: List[str], available_at_forecast_columns: List[str], forecast_horizon: int, data_granularity_unit: str, data_granularity_count: int, optimization_objective: Optional[str] = None, column_transformations: Optional[Union[Dict, List[Dict]]] = None, project: Optional[str] = None, location: Optional[str] = None, predefined_split_column_name: Optional[str] = None, weight_column: Optional[str] = None, time_series_attribute_columns: Optional[List[str]] = None, context_window: Optional[int] = None, export_evaluated_data_items: bool = False, export_evaluated_data_items_bigquery_destination_uri: Optional[str] = None, export_evaluated_data_items_override_destination: bool = False, quantiles: Optional[List[float]] = None, validation_options: Optional[str] = None, budget_milli_node_hours: int = 1000, model_display_name: Optional[str] = None) google.cloud.aiplatform.models.Model

Runs the training job and returns a model. The training data splits are set by default: Roughly 80% will be used for training, 10% for validation, and 10% for test.

Args:
dataset (datasets.Dataset):

Required. The dataset within the same Project from which data will be used to train the Model. The Dataset must use schema compatible with Model being trained, and what is compatible should be described in the used TrainingPipeline’s [training_task_definition] [google.cloud.aiplatform.v1beta1.TrainingPipeline.training_task_definition]. For time series Datasets, all their data is exported to training, to pick and choose from.

target_column (str):

Required. Name of the column that the Model is to predict values for.

time_column (str):

Required. Name of the column that identifies time order in the time series.

time_series_identifier_column (str):

Required. Name of the column that identifies the time series.

unavailable_at_forecast_columns (List[str]):

Required. Column names of columns that are unavailable at forecast. Each column contains information for the given entity (identified by the [time_series_identifier_column]) that is unknown before the forecast (e.g. population of a city in a given year, or weather on a given day).

available_at_forecast_columns (List[str]):

Required. Column names of columns that are available at forecast. Each column contains information for the given entity (identified by the [time_series_identifier_column]) that is known at forecast.

forecast_horizon: (int):

Required. The amount of time into the future for which forecasted values for the target are returned. Expressed in number of units defined by the [data_granularity_unit] and [data_granularity_count] field. Inclusive.

data_granularity_unit (str):

Required. The data granularity unit. Accepted values are minute, hour, day, week, month, year.

data_granularity_count (int):

Required. The number of data granularity units between data points in the training data. If [data_granularity_unit] is minute, can be 1, 5, 10, 15, or 30. For all other values of [data_granularity_unit], must be 1.

predefined_split_column_name (str):

Optional. The key is a name of one of the Dataset’s data columns. The value of the key (either the label’s value or value in the column) must be one of {TRAIN, VALIDATE, TEST}, and it defines to which set the given piece of data is assigned. If for a piece of data the key is not present or has an invalid value, that piece is ignored by the pipeline.

Supported only for tabular and time series Datasets.

weight_column (str):

Optional. Name of the column that should be used as the weight column. Higher values in this column give more importance to the row during Model training. The column must have numeric values between 0 and 10000 inclusively, and 0 value means that the row is ignored. If the weight column field is not set, then all rows are assumed to have equal weight of 1.

time_series_attribute_columns (List[str]):

Optional. Column names that should be used as attribute columns. Each column is constant within a time series.

context_window (int):

Optional. The amount of time into the past training and prediction data is used for model training and prediction respectively. Expressed in number of units defined by the [data_granularity_unit] and [data_granularity_count] fields. When not provided uses the default value of 0 which means the model sets each series context window to be 0 (also known as “cold start”). Inclusive.

export_evaluated_data_items (bool):

Whether to export the test set predictions to a BigQuery table. If False, then the export is not performed.

export_evaluated_data_items_bigquery_destination_uri (string):

Optional. URI of desired destination BigQuery table for exported test set predictions.

Expected format: bq://<project_id>:<dataset_id>:<table>

If not specified, then results are exported to the following auto-created BigQuery table: <project_id>:export_evaluated_examples_<model_name>_<yyyy_MM_dd'T'HH_mm_ss_SSS'Z'>.evaluated_examples

Applies only if [export_evaluated_data_items] is True.

export_evaluated_data_items_override_destination (bool):

Whether to override the contents of [export_evaluated_data_items_bigquery_destination_uri], if the table exists, for exported test set predictions. If False, and the table exists, then the training job will fail.

Applies only if [export_evaluated_data_items] is True and [export_evaluated_data_items_bigquery_destination_uri] is specified.

quantiles (List[float]):

Quantiles to use for the minizmize-quantile-loss [AutoMLForecastingTrainingJob.optimization_objective]. This argument is required in this case.

Accepts up to 5 quantiles in the form of a double from 0 to 1, exclusive. Each quantile must be unique.

validation_options (str):

Validation options for the data validation component. The available options are: “fail-pipeline” - (default), will validate against the validation and fail the pipeline

if it fails.

“ignore-validation” - ignore the results of the validation and continue the pipeline

budget_milli_node_hours (int):

Optional. The train budget of creating this Model, expressed in milli node hours i.e. 1,000 value in this field means 1 node hour. The training cost of the model will not exceed this budget. The final cost will be attempted to be close to the budget, though may end up being (even) noticeably smaller - at the backend’s discretion. This especially may happen when further model training ceases to provide any improvements. If the budget is set to a value known to be insufficient to train a Model for the given training set, the training won’t be attempted and will error. The minimum value is 1000 and the maximum is 72000.

model_display_name (str):

Optional. If the script produces a managed Vertex AI Model. The display name of the Model. The name can be up to 128 characters long and can be consist of any UTF-8 characters.

If not provided upon creation, the job’s display_name is used.

sync (bool):

Whether to execute this method synchronously. If False, this method will be executed in concurrent Future and any downstream object will be immediately returned and synced when the Future has completed.

Returns:
model: The trained Vertex AI Model resource or None if training did not

produce a Vertex AI Model.

Raises:

RuntimeError if Training job has already been run or is waiting to run.

Args:
display_name:

Required. The user-defined name of this TrainingPipeline.

optimization_objective:

Optional. Objective function the model is to be optimized towards. The training process creates a Model that optimizes the value of the objective function over the validation set. The supported optimization objectives: “minimize-rmse” (default) - Minimize root-mean-squared error (RMSE). “minimize-mae” - Minimize mean-absolute error (MAE). “minimize-rmsle” - Minimize root-mean-squared log error (RMSLE). “minimize-rmspe” - Minimize root-mean-squared percentage error (RMSPE). “minimize-wape-mae” - Minimize the combination of weighted absolute percentage error (WAPE)

and mean-absolute-error (MAE).

“minimize-quantile-loss” - Minimize the quantile loss at the defined quantiles.

(Set this objective to build quantile forecasts.)

column_transformations:

Optional. Transformations to apply to the input columns (i.e. columns other than the targetColumn). Each transformation may produce multiple result values from the column’s value, and all are used for training. When creating transformation for BigQuery Struct column, the column should be flattened using “.” as the delimiter. If an input column has no transformations on it, such a column is ignored by the training, except for the targetColumn, which should have no transformations defined on.

project:

Optional. Project to run training in. Overrides project set in aiplatform.init.

location:

Optional. Location to run training in. Overrides location set in aiplatform.init.

google_cloud_pipeline_components.aiplatform.AutoMLImageTrainingJobRunOp(display_name: str, dataset: google.cloud.aiplatform.datasets.image_dataset.ImageDataset, prediction_type: str = 'classification', multi_label: bool = False, model_type: str = 'CLOUD', base_model: Optional[google.cloud.aiplatform.models.Model] = None, project: Optional[str] = None, location: Optional[str] = None, training_encryption_spec_key_name: Optional[str] = None, model_encryption_spec_key_name: Optional[str] = None, training_fraction_split: float = 0.8, validation_fraction_split: float = 0.1, test_fraction_split: float = 0.1, budget_milli_node_hours: int = 1000, model_display_name: Optional[str] = None, disable_early_stopping: bool = False) google.cloud.aiplatform.models.Model

Runs the AutoML Image training job and returns a model. Data fraction splits: Any of training_fraction_split, validation_fraction_split and test_fraction_split may optionally be provided, they must sum to up to 1. If the provided ones sum to less than 1, the remainder is assigned to sets as decided by Vertex AI. If none of the fractions are set, by default roughly 80% of data will be used for training, 10% for validation, and 10% for test.

Args:
dataset:

Required. The dataset within the same Project from which data will be used to train the Model. The Dataset must use schema compatible with Model being trained, and what is compatible should be described in the used TrainingPipeline’s [training_task_definition] [google.cloud.aiplatform.v1beta1.TrainingPipeline.training_task_definition]. For tabular Datasets, all their data is exported to training, to pick and choose from.

training_fraction_split:

float = 0.8 Required. The fraction of the input data that is to be used to train the Model. This is ignored if Dataset is not provided.

validation_fraction_split:

float = 0.1 Required. The fraction of the input data that is to be used to validate the Model. This is ignored if Dataset is not provided.

test_fraction_split:

float = 0.1 Required. The fraction of the input data that is to be used to evaluate the Model. This is ignored if Dataset is not provided.

budget_milli_node_hours:

int = 1000 Optional. The train budget of creating this Model, expressed in milli node hours i.e. 1,000 value in this field means 1 node hour. The training cost of the model will not exceed this budget. The final cost will be attempted to be close to the budget, though may end up being (even) noticeably smaller - at the backend’s discretion. This especially may happen when further model training ceases to provide any improvements. If the budget is set to a value known to be insufficient to train a Model for the given training set, the training won’t be attempted and will error. The minimum value is 1000 and the maximum is 72000.

model_display_name:

Optional. The display name of the managed Vertex AI Model. The name can be up to 128 characters long and can be consist of any UTF-8 characters. If not provided upon creation, the job’s display_name is used.

disable_early_stopping:

bool = False Required. If true, the entire budget is used. This disables the early stopping feature. By default, the early stopping feature is enabled, which means that training might stop before the entire training budget has been used, if further training does no longer brings significant improvement to the model.

display_name:

Required. The user-defined name of this TrainingPipeline.

prediction_type:

The type of prediction the Model is to produce, one of: “classification” - Predict one out of multiple target values is

picked for each row.

“object_detection” - Predict a value based on its relation to other values.

This type is available only to columns that contain semantically numeric values, i.e. integers or floating point number, even if stored as e.g. strings.

multi_label:

bool = False Required. Default is False. If false, a single-label (multi-class) Model will be trained (i.e. assuming that for each image just up to one annotation may be applicable). If true, a multi-label Model will be trained (i.e. assuming that for each image multiple annotations may be applicable).

This is only applicable for the “classification” prediction_type and will be ignored otherwise.

model_type:

str = “CLOUD” Required. One of the following: “CLOUD” - Default for Image Classification.

A Model best tailored to be used within Google Cloud, and which cannot be exported.

“CLOUD_HIGH_ACCURACY_1” - Default for Image Object Detection.

A model best tailored to be used within Google Cloud, and which cannot be exported. Expected to have a higher latency, but should also have a higher prediction quality than other cloud models.

“CLOUD_LOW_LATENCY_1” - A model best tailored to be used within

Google Cloud, and which cannot be exported. Expected to have a low latency, but may have lower prediction quality than other cloud models.

“MOBILE_TF_LOW_LATENCY_1” - A model that, in addition to being

available within Google Cloud, can also be exported as TensorFlow or Core ML model and used on a mobile or edge device afterwards. Expected to have low latency, but may have lower prediction quality than other mobile models.

“MOBILE_TF_VERSATILE_1” - A model that, in addition to being

available within Google Cloud, can also be exported as TensorFlow or Core ML model and used on a mobile or edge device with afterwards.

“MOBILE_TF_HIGH_ACCURACY_1” - A model that, in addition to being

available within Google Cloud, can also be exported as TensorFlow or Core ML model and used on a mobile or edge device afterwards. Expected to have a higher latency, but should also have a higher prediction quality than other mobile models.

base_model:

Optional[models.Model] = None Optional. Only permitted for Image Classification models. If it is specified, the new model will be trained based on the base model. Otherwise, the new model will be trained from scratch. The base model must be in the same Project and Location as the new Model to train, and have the same model_type.

project:

Optional. Project to run training in. Overrides project set in aiplatform.init.

location:

Optional. Location to run training in. Overrides location set in aiplatform.init.

training_encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the training pipeline. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, this TrainingPipeline will be secured by this key.

Note: Model trained by this TrainingPipeline is also secured by this key if model_to_upload is not set separately.

Overrides encryption_spec_key_name set in aiplatform.init.

model_encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the model. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, the trained Model will be secured by this key.

Overrides encryption_spec_key_name set in aiplatform.init.

Returns:

The trained Vertex AI Model resource or None if training did not produce a Vertex AI Model.

Raises:
RuntimeError:

If Training job has already been run or is waiting to run.

google_cloud_pipeline_components.aiplatform.AutoMLTabularTrainingJobRunOp(display_name: str, optimization_prediction_type: str, dataset: google.cloud.aiplatform.datasets.tabular_dataset.TabularDataset, target_column: str, optimization_objective: Optional[str] = None, column_specs: Optional[Dict[str, str]] = None, column_transformations: Optional[Union[Dict, List[Dict]]] = None, optimization_objective_recall_value: Optional[float] = None, optimization_objective_precision_value: Optional[float] = None, project: Optional[str] = None, location: Optional[str] = None, training_encryption_spec_key_name: Optional[str] = None, model_encryption_spec_key_name: Optional[str] = None, training_fraction_split: float = 0.8, validation_fraction_split: float = 0.1, test_fraction_split: float = 0.1, predefined_split_column_name: Optional[str] = None, weight_column: Optional[str] = None, budget_milli_node_hours: int = 1000, model_display_name: Optional[str] = None, disable_early_stopping: bool = False) google.cloud.aiplatform.models.Model

Runs the training job and returns a model. Data fraction splits: Any of training_fraction_split, validation_fraction_split and test_fraction_split may optionally be provided, they must sum to up to 1. If the provided ones sum to less than 1, the remainder is assigned to sets as decided by Vertex AI. If none of the fractions are set, by default roughly 80% of data will be used for training, 10% for validation, and 10% for test.

Args:
dataset:

Required. The dataset within the same Project from which data will be used to train the Model. The Dataset must use schema compatible with Model being trained, and what is compatible should be described in the used TrainingPipeline’s [training_task_definition] [google.cloud.aiplatform.v1beta1.TrainingPipeline.training_task_definition]. For tabular Datasets, all their data is exported to training, to pick and choose from.

target_column:

Required. The name of the column values of which the Model is to predict.

training_fraction_split:

Required. The fraction of the input data that is to be used to train the Model. This is ignored if Dataset is not provided.

validation_fraction_split:

Required. The fraction of the input data that is to be used to validate the Model. This is ignored if Dataset is not provided.

test_fraction_split:

Required. The fraction of the input data that is to be used to evaluate the Model. This is ignored if Dataset is not provided.

predefined_split_column_name:

Optional. The key is a name of one of the Dataset’s data columns. The value of the key (either the label’s value or value in the column) must be one of {training, validation, test}, and it defines to which set the given piece of data is assigned. If for a piece of data the key is not present or has an invalid value, that piece is ignored by the pipeline.

Supported only for tabular and time series Datasets.

weight_column:

Optional. Name of the column that should be used as the weight column. Higher values in this column give more importance to the row during Model training. The column must have numeric values between 0 and 10000 inclusively, and 0 value means that the row is ignored. If the weight column field is not set, then all rows are assumed to have equal weight of 1.

budget_milli_node_hours:

Optional. The train budget of creating this Model, expressed in milli node hours i.e. 1,000 value in this field means 1 node hour. The training cost of the model will not exceed this budget. The final cost will be attempted to be close to the budget, though may end up being (even) noticeably smaller - at the backend’s discretion. This especially may happen when further model training ceases to provide any improvements. If the budget is set to a value known to be insufficient to train a Model for the given training set, the training won’t be attempted and will error. The minimum value is 1000 and the maximum is 72000.

model_display_name:

Optional. If the script produces a managed Vertex AI Model. The display name of the Model. The name can be up to 128 characters long and can be consist of any UTF-8 characters.

If not provided upon creation, the job’s display_name is used.

disable_early_stopping:

Required. If true, the entire budget is used. This disables the early stopping feature. By default, the early stopping feature is enabled, which means that training might stop before the entire training budget has been used, if further training does no longer brings significant improvement to the model.

display_name:

Required. The user-defined name of this TrainingPipeline.

optimization_prediction_type:

The type of prediction the Model is to produce. “classification” - Predict one out of multiple target values is picked for each row. “regression” - Predict a value based on its relation to other values. This type is available only to columns that contain semantically numeric values, i.e. integers or floating point number, even if stored as e.g. strings.

optimization_objective:

Optional. Objective function the Model is to be optimized towards. The training task creates a Model that maximizes/minimizes the value of the objective function over the validation set.

The supported optimization objectives depend on the prediction type, and in the case of classification also the number of distinct values in the target column (two distint values -> binary, 3 or more distinct values -> multi class). If the field is not set, the default objective function is used.

Classification (binary): “maximize-au-roc” (default) - Maximize the area under the receiver

operating characteristic (ROC) curve.

“minimize-log-loss” - Minimize log loss. “maximize-au-prc” - Maximize the area under the precision-recall curve. “maximize-precision-at-recall” - Maximize precision for a specified

recall value.

“maximize-recall-at-precision” - Maximize recall for a specified

precision value.

Classification (multi class): “minimize-log-loss” (default) - Minimize log loss.

Regression: “minimize-rmse” (default) - Minimize root-mean-squared error (RMSE). “minimize-mae” - Minimize mean-absolute error (MAE). “minimize-rmsle” - Minimize root-mean-squared log error (RMSLE).

column_specs:

Optional. Alternative to column_transformations where the keys of the dict are column names and their respective values are one of AutoMLTabularTrainingJob.column_data_types. When creating transformation for BigQuery Struct column, the column should be flattened using “.” as the delimiter. Only columns with no child should have a transformation. If an input column has no transformations on it, such a column is ignored by the training, except for the targetColumn, which should have no transformations defined on. Only one of column_transformations or column_specs should be passed.

column_transformations:

Optional. Transformations to apply to the input columns (i.e. columns other than the targetColumn). Each transformation may produce multiple result values from the column’s value, and all are used for training. When creating transformation for BigQuery Struct column, the column should be flattened using “.” as the delimiter. Only columns with no child should have a transformation. If an input column has no transformations on it, such a column is ignored by the training, except for the targetColumn, which should have no transformations defined on. Only one of column_transformations or column_specs should be passed. Consider using column_specs as column_transformations will be deprecated eventually.

optimization_objective_recall_value:

Optional. Required when maximize-precision-at-recall optimizationObjective was picked, represents the recall value at which the optimization is done.

The minimum value is 0 and the maximum is 1.0.

optimization_objective_precision_value:

Optional. Required when maximize-recall-at-precision optimizationObjective was picked, represents the precision value at which the optimization is done.

The minimum value is 0 and the maximum is 1.0.

project:

Optional. Project to run training in. Overrides project set in aiplatform.init.

location:

Optional. Location to run training in. Overrides location set in aiplatform.init.

training_encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the training pipeline. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, this TrainingPipeline will be secured by this key.

Note: Model trained by this TrainingPipeline is also secured by this key if model_to_upload is not set separately.

Overrides encryption_spec_key_name set in aiplatform.init.

model_encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the model. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, the trained Model will be secured by this key.

Overrides encryption_spec_key_name set in aiplatform.init.

Returns:

The trained Vertex AI Model resource or None if training did not produce a Vertex AI Model.

Raises:
RuntimeError:

If Training job has already been run or is waiting to run.

google_cloud_pipeline_components.aiplatform.AutoMLTextTrainingJobRunOp(display_name: str, prediction_type: str, dataset: google.cloud.aiplatform.datasets.text_dataset.TextDataset, multi_label: bool = False, sentiment_max: int = 10, project: Optional[str] = None, location: Optional[str] = None, training_encryption_spec_key_name: Optional[str] = None, model_encryption_spec_key_name: Optional[str] = None, training_fraction_split: float = 0.8, validation_fraction_split: float = 0.1, test_fraction_split: float = 0.1, model_display_name: Optional[str] = None) google.cloud.aiplatform.models.Model

Runs the training job and returns a model. Data fraction splits: Any of training_fraction_split, validation_fraction_split and test_fraction_split may optionally be provided, they must sum to up to 1. If the provided ones sum to less than 1, the remainder is assigned to sets as decided by Vertex AI. If none of the fractions are set, by default roughly 80% of data will be used for training, 10% for validation, and 10% for test.

Args:
dataset:

Required. The dataset within the same Project from which data will be used to train the Model. The Dataset must use schema compatible with Model being trained, and what is compatible should be described in the used TrainingPipeline’s [training_task_definition] [google.cloud.aiplatform.v1beta1.TrainingPipeline.training_task_definition].

training_fraction_split:

float = 0.8 Required. The fraction of the input data that is to be used to train the Model. This is ignored if Dataset is not provided.

validation_fraction_split:

float = 0.1 Required. The fraction of the input data that is to be used to validate the Model. This is ignored if Dataset is not provided.

test_fraction_split:

float = 0.1 Required. The fraction of the input data that is to be used to evaluate the Model. This is ignored if Dataset is not provided.

model_display_name:

Optional. The display name of the managed Vertex AI Model. The name can be up to 128 characters long and can consist of any UTF-8 characters.

If not provided upon creation, the job’s display_name is used.

display_name:

Required. The user-defined name of this TrainingPipeline.

prediction_type:

The type of prediction the Model is to produce, one of: “classification” - A classification model analyzes text data and

returns a list of categories that apply to the text found in the data. Vertex AI offers both single-label and multi-label text classification models.

“extraction” - An entity extraction model inspects text data

for known entities referenced in the data and labels those entities in the text.

“sentiment” - A sentiment analysis model inspects text data and identifies the

prevailing emotional opinion within it, especially to determine a writer’s attitude as positive, negative, or neutral.

multi_label:

Required and only applicable for text classification task. If false, a single-label (multi-class) Model will be trained (i.e. assuming that for each text snippet just up to one annotation may be applicable). If true, a multi-label Model will be trained (i.e. assuming that for each text snippet multiple annotations may be applicable).

sentiment_max:

Required and only applicable for sentiment task. A sentiment is expressed as an integer ordinal, where higher value means a more positive sentiment. The range of sentiments that will be used is between 0 and sentimentMax (inclusive on both ends), and all the values in the range must be represented in the dataset before a model can be created. Only the Annotations with this sentimentMax will be used for training. sentimentMax value must be between 1 and 10 (inclusive).

project:

Optional. Project to run training in. Overrides project set in aiplatform.init.

location:

Optional. Location to run training in. Overrides location set in aiplatform.init.

training_encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the training pipeline. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, this TrainingPipeline will be secured by this key.

Note: Model trained by this TrainingPipeline is also secured by this key if model_to_upload is not set separately.

Overrides encryption_spec_key_name set in aiplatform.init.

model_encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the model. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, the trained Model will be secured by this key.

Overrides encryption_spec_key_name set in aiplatform.init.

Returns:

The trained Vertex AI Model resource.

Raises:
RuntimeError:

If Training job has already been run or is waiting to run.

google_cloud_pipeline_components.aiplatform.AutoMLVideoTrainingJobRunOp(display_name: str, dataset: google.cloud.aiplatform.datasets.video_dataset.VideoDataset, prediction_type: str = 'classification', model_type: str = 'CLOUD', project: Optional[str] = None, location: Optional[str] = None, training_encryption_spec_key_name: Optional[str] = None, model_encryption_spec_key_name: Optional[str] = None, training_fraction_split: float = 0.8, test_fraction_split: float = 0.2, model_display_name: Optional[str] = None) google.cloud.aiplatform.models.Model

Runs the AutoML Image training job and returns a model. Data fraction splits: training_fraction_split, and test_fraction_split may optionally be provided, they must sum to up to 1. If none of the fractions are set, by default roughly 80% of data will be used for training, and 20% for test.

Args:
dataset:

Required. The dataset within the same Project from which data will be used to train the Model. The Dataset must use schema compatible with Model being trained, and what is compatible should be described in the used TrainingPipeline’s [training_task_definition] [google.cloud.aiplatform.v1beta1.TrainingPipeline.training_task_definition]. For tabular Datasets, all their data is exported to training, to pick and choose from.

training_fraction_split:

float = 0.8 Required. The fraction of the input data that is to be used to train the Model. This is ignored if Dataset is not provided.

test_fraction_split:

float = 0.2 Required. The fraction of the input data that is to be used to evaluate the Model. This is ignored if Dataset is not provided.

model_display_name:

Optional. The display name of the managed Vertex AI Model. The name can be up to 128 characters long and can be consist of any UTF-8 characters. If not provided upon creation, the job’s display_name is used.

display_name:

Required. The user-defined name of this TrainingPipeline.

prediction_type:

The type of prediction the Model is to produce, one of: “classification” - A video classification model classifies shots

and segments in your videos according to your own defined labels.

“object_tracking” - A video object tracking model detects and tracks

multiple objects in shots and segments. You can use these models to track objects in your videos according to your own pre-defined, custom labels.

“action_recognition” - A video action reconition model pinpoints

the location of actions with short temporal durations (~1 second).

model_type:

str = “CLOUD” Required. One of the following: “CLOUD” - available for “classification”, “object_tracking” and “action_recognition”

A Model best tailored to be used within Google Cloud, and which cannot be exported.

“MOBILE_VERSATILE_1” - available for “classification”, “object_tracking” and “action_recognition”

A model that, in addition to being available within Google Cloud, can also be exported (see ModelService.ExportModel) as a TensorFlow or TensorFlow Lite model and used on a mobile or edge device with afterwards.

“MOBILE_CORAL_VERSATILE_1” - available only for “object_tracking”

A versatile model that is meant to be exported (see ModelService.ExportModel) and used on a Google Coral device.

“MOBILE_CORAL_LOW_LATENCY_1” - available only for “object_tracking”

A model that trades off quality for low latency, to be exported (see ModelService.ExportModel) and used on a Google Coral device.

“MOBILE_JETSON_VERSATILE_1” - available only for “object_tracking”

A versatile model that is meant to be exported (see ModelService.ExportModel) and used on an NVIDIA Jetson device.

“MOBILE_JETSON_LOW_LATENCY_1” - available only for “object_tracking”

A model that trades off quality for low latency, to be exported (see ModelService.ExportModel) and used on an NVIDIA Jetson device.

project:

Optional. Project to run training in. Overrides project set in aiplatform.init.

location:

Optional. Location to run training in. Overrides location set in aiplatform.init.

training_encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the training pipeline. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, this TrainingPipeline will be secured by this key.

Note: Model trained by this TrainingPipeline is also secured by this key if model_to_upload is not set separately.

Overrides encryption_spec_key_name set in aiplatform.init.

model_encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the model. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, the trained Model will be secured by this key.

Overrides encryption_spec_key_name set in aiplatform.init.

Returns:

The trained Vertex AI Model resource or None if training did not produce a Vertex AI Model.

Raises:
RuntimeError:

If Training job has already been run or is waiting to run.

google_cloud_pipeline_components.aiplatform.CustomContainerTrainingJobRunOp(display_name: str, container_uri: str, command: Sequence[str] = None, model_serving_container_image_uri: Optional[str] = None, model_serving_container_predict_route: Optional[str] = None, model_serving_container_health_route: Optional[str] = None, model_serving_container_command: Optional[Sequence[str]] = None, model_serving_container_args: Optional[Sequence[str]] = None, model_serving_container_environment_variables: Optional[Dict[str, str]] = None, model_serving_container_ports: Optional[Sequence[int]] = None, model_description: Optional[str] = None, model_instance_schema_uri: Optional[str] = None, model_parameters_schema_uri: Optional[str] = None, model_prediction_schema_uri: Optional[str] = None, project: Optional[str] = None, location: Optional[str] = None, training_encryption_spec_key_name: Optional[str] = None, model_encryption_spec_key_name: Optional[str] = None, staging_bucket: Optional[str] = None, dataset: Optional[Union[google.cloud.aiplatform.datasets.image_dataset.ImageDataset, google.cloud.aiplatform.datasets.tabular_dataset.TabularDataset, google.cloud.aiplatform.datasets.text_dataset.TextDataset, google.cloud.aiplatform.datasets.video_dataset.VideoDataset]] = None, annotation_schema_uri: Optional[str] = None, model_display_name: Optional[str] = None, base_output_dir: Optional[str] = None, service_account: Optional[str] = None, network: Optional[str] = None, bigquery_destination: Optional[str] = None, args: Optional[List[Union[float, int, str]]] = None, environment_variables: Optional[Dict[str, str]] = None, replica_count: int = 1, machine_type: str = 'n1-standard-4', accelerator_type: str = 'ACCELERATOR_TYPE_UNSPECIFIED', accelerator_count: int = 0, training_fraction_split: float = 0.8, validation_fraction_split: float = 0.1, test_fraction_split: float = 0.1, predefined_split_column_name: Optional[str] = None, tensorboard: Optional[str] = None) Optional[google.cloud.aiplatform.models.Model]

Runs the custom training job. Distributed Training Support: If replica count = 1 then one chief replica will be provisioned. If replica_count > 1 the remainder will be provisioned as a worker replica pool. ie: replica_count = 10 will result in 1 chief and 9 workers All replicas have same machine_type, accelerator_type, and accelerator_count

Data fraction splits: Any of training_fraction_split, validation_fraction_split and test_fraction_split may optionally be provided, they must sum to up to 1. If the provided ones sum to less than 1, the remainder is assigned to sets as decided by Vertex AI. If none of the fractions are set, by default roughly 80% of data will be used for training, 10% for validation, and 10% for test.

Args:
dataset:

Vertex AI to fit this training against. Custom training script should retrieve datasets through passed in environment variables uris:

os.environ[“AIP_TRAINING_DATA_URI”] os.environ[“AIP_VALIDATION_DATA_URI”] os.environ[“AIP_TEST_DATA_URI”]

Additionally the dataset format is passed in as:

os.environ[“AIP_DATA_FORMAT”]

annotation_schema_uri:

Google Cloud Storage URI points to a YAML file describing annotation schema. The schema is defined as an OpenAPI 3.0.2 [Schema Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schema-object) The schema files that can be used here are found in gs://google-cloud-aiplatform/schema/dataset/annotation/, note that the chosen schema must be consistent with metadata of the Dataset specified by dataset_id.

Only Annotations that both match this schema and belong to DataItems not ignored by the split method are used in respectively training, validation or test role, depending on the role of the DataItem they are on.

When used in conjunction with annotations_filter, the Annotations used for training are filtered by both annotations_filter and annotation_schema_uri.

model_display_name:

If the script produces a managed Vertex AI Model. The display name of the Model. The name can be up to 128 characters long and can be consist of any UTF-8 characters.

If not provided upon creation, the job’s display_name is used.

base_output_dir:

GCS output directory of job. If not provided a timestamped directory in the staging directory will be used.

Vertex AI sets the following environment variables when it runs your training code:

  • AIP_MODEL_DIR: a Cloud Storage URI of a directory intended for saving model artifacts, i.e. <base_output_dir>/model/

  • AIP_CHECKPOINT_DIR: a Cloud Storage URI of a directory intended for saving checkpoints, i.e. <base_output_dir>/checkpoints/

  • AIP_TENSORBOARD_LOG_DIR: a Cloud Storage URI of a directory intended for saving TensorBoard logs, i.e. <base_output_dir>/logs/

service_account:

Specifies the service account for workload run-as account. Users submitting jobs must have act-as permission on this run-as account.

network:

The full name of the Compute Engine network to which the job should be peered. For example, projects/12345/global/networks/myVPC. Private services access must already be configured for the network. If left unspecified, the job is not peered with any network.

bigquery_destination:

Provide this field if dataset is a BiqQuery dataset. The BigQuery project location where the training data is to be written to. In the given project a new dataset is created with name dataset_<dataset-id>_<annotation-type>_<timestamp-of-training-call> where timestamp is in YYYY_MM_DDThh_mm_ss_sssZ format. All training input data will be written into that dataset. In the dataset three tables will be created, training, validation and test.

  • AIP_DATA_FORMAT = “bigquery”.

  • AIP_TRAINING_DATA_URI =”bigquery_destination.dataset_*.training”

  • AIP_VALIDATION_DATA_URI = “bigquery_destination.dataset_*.validation”

  • AIP_TEST_DATA_URI = “bigquery_destination.dataset_*.test”

args:

Command line arguments to be passed to the Python script.

environment_variables:

Environment variables to be passed to the container. Should be a dictionary where keys are environment variable names and values are environment variable values for those names. At most 10 environment variables can be specified. The Name of the environment variable must be unique.

environment_variables = {

‘MY_KEY’: ‘MY_VALUE’

}

replica_count:

The number of worker replicas. If replica count = 1 then one chief replica will be provisioned. If replica_count > 1 the remainder will be provisioned as a worker replica pool.

machine_type:

The type of machine to use for training.

accelerator_type:

Hardware accelerator type. One of ACCELERATOR_TYPE_UNSPECIFIED, NVIDIA_TESLA_K80, NVIDIA_TESLA_P100, NVIDIA_TESLA_V100, NVIDIA_TESLA_P4, NVIDIA_TESLA_T4

accelerator_count:

The number of accelerators to attach to a worker replica.

training_fraction_split:

The fraction of the input data that is to be used to train the Model. This is ignored if Dataset is not provided.

validation_fraction_split:

The fraction of the input data that is to be used to validate the Model. This is ignored if Dataset is not provided.

test_fraction_split:

The fraction of the input data that is to be used to evaluate the Model. This is ignored if Dataset is not provided.

predefined_split_column_name:

Optional. The key is a name of one of the Dataset’s data columns. The value of the key (either the label’s value or value in the column) must be one of {training, validation, test}, and it defines to which set the given piece of data is assigned. If for a piece of data the key is not present or has an invalid value, that piece is ignored by the pipeline.

Supported only for tabular and time series Datasets.

tensorboard:

Optional. The name of a Vertex AI [Tensorboard][google.cloud.aiplatform.v1beta1.Tensorboard] resource to which this CustomJob will upload Tensorboard logs. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}

The training script should write Tensorboard to following Vertex AI environment variable:

AIP_TENSORBOARD_LOG_DIR

service_account is required with provided tensorboard. For more information on configuring your service account please visit: https://cloud.google.com/vertex-ai/docs/experiments/tensorboard-training

display_name:

Required. The user-defined name of this TrainingPipeline.

container_uri:

Required: Uri of the training container image in the GCR.

command:

The command to be invoked when the container is started. It overrides the entrypoint instruction in Dockerfile when provided

model_serving_container_image_uri:

If the training produces a managed Vertex AI Model, the URI of the Model serving container suitable for serving the model produced by the training script.

model_serving_container_predict_route:

If the training produces a managed Vertex AI Model, 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.

model_serving_container_health_route:

If the training produces a managed Vertex AI Model, 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 AI Platform.

model_serving_container_command:

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.

model_serving_container_args:

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.

model_serving_container_environment_variables:

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.

model_serving_container_ports:

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.

model_description:

The description of the Model.

model_instance_schema_uri:

Optional. Points to a YAML file stored on Google Cloud Storage describing the format of a single instance, which are used in PredictRequest.instances, ExplainRequest.instances and BatchPredictionJob.input_config. The schema is defined as an OpenAPI 3.0.2 Schema Object. AutoML Models always have this field populated by AI Platform. Note: The URI given on output will be immutable and probably different, including the URI scheme, than the one given on input. The output URI will point to a location where the user only has a read access.

model_parameters_schema_uri:

Optional. Points to a YAML file stored on Google Cloud Storage describing the parameters of prediction and explanation via PredictRequest.parameters, ExplainRequest.parameters and BatchPredictionJob.model_parameters. The schema is defined as an OpenAPI 3.0.2 Schema Object. AutoML Models always have this field populated by AI Platform, if no parameters are supported it is set to an empty string. Note: The URI given on output will be immutable and probably different, including the URI scheme, than the one given on input. The output URI will point to a location where the user only has a read access.

model_prediction_schema_uri:

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 PredictResponse.predictions, ExplainResponse.explanations, and BatchPredictionJob.output_config. The schema is defined as an OpenAPI 3.0.2 Schema Object. AutoML Models always have this field populated by AI Platform. Note: The URI given on output will be immutable and probably different, including the URI scheme, than the one given on input. The output URI will point to a location where the user only has a read access.

project:

Project to run training in. Overrides project set in aiplatform.init.

location:

Location to run training in. Overrides location set in aiplatform.init.

training_encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the training pipeline. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, this TrainingPipeline will be secured by this key.

Note: Model trained by this TrainingPipeline is also secured by this key if model_to_upload is not set separately.

Overrides encryption_spec_key_name set in aiplatform.init.

model_encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the model. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, the trained Model will be secured by this key.

Overrides encryption_spec_key_name set in aiplatform.init.

staging_bucket:

Bucket used to stage source and training artifacts. Overrides staging_bucket set in aiplatform.init.

Returns:

The trained Vertex AI Model resource or None if training did not produce a Vertex AI Model.

Raises:
RuntimeError:

If Training job has already been run, staging_bucket has not been set, or model_display_name was provided but required arguments were not provided in constructor.

google_cloud_pipeline_components.aiplatform.CustomPythonPackageTrainingJobRunOp(display_name: str, python_package_gcs_uri: str, python_module: google.cloud.aiplatform.training_jobs.CustomPythonPackageTrainingJob, container_uri: str, model_serving_container_image_uri: Optional[str] = None, model_serving_container_predict_route: Optional[str] = None, model_serving_container_health_route: Optional[str] = None, model_serving_container_command: Optional[Sequence[str]] = None, model_serving_container_args: Optional[Sequence[str]] = None, model_serving_container_environment_variables: Optional[Dict[str, str]] = None, model_serving_container_ports: Optional[Sequence[int]] = None, model_description: Optional[str] = None, model_instance_schema_uri: Optional[str] = None, model_parameters_schema_uri: Optional[str] = None, model_prediction_schema_uri: Optional[str] = None, project: Optional[str] = None, location: Optional[str] = None, training_encryption_spec_key_name: Optional[str] = None, model_encryption_spec_key_name: Optional[str] = None, staging_bucket: Optional[str] = None, dataset: Optional[Union[google.cloud.aiplatform.datasets.image_dataset.ImageDataset, google.cloud.aiplatform.datasets.tabular_dataset.TabularDataset, google.cloud.aiplatform.datasets.text_dataset.TextDataset, google.cloud.aiplatform.datasets.video_dataset.VideoDataset]] = None, annotation_schema_uri: Optional[str] = None, model_display_name: Optional[str] = None, base_output_dir: Optional[str] = None, service_account: Optional[str] = None, network: Optional[str] = None, bigquery_destination: Optional[str] = None, args: Optional[List[Union[float, int, str]]] = None, environment_variables: Optional[Dict[str, str]] = None, replica_count: int = 1, machine_type: str = 'n1-standard-4', accelerator_type: str = 'ACCELERATOR_TYPE_UNSPECIFIED', accelerator_count: int = 0, training_fraction_split: float = 0.8, validation_fraction_split: float = 0.1, test_fraction_split: float = 0.1, predefined_split_column_name: Optional[str] = None, tensorboard: Optional[str] = None) Optional[google.cloud.aiplatform.models.Model]

Runs the custom training job. Distributed Training Support: If replica count = 1 then one chief replica will be provisioned. If replica_count > 1 the remainder will be provisioned as a worker replica pool. ie: replica_count = 10 will result in 1 chief and 9 workers All replicas have same machine_type, accelerator_type, and accelerator_count

Data fraction splits: Any of training_fraction_split, validation_fraction_split and test_fraction_split may optionally be provided, they must sum to up to 1. If the provided ones sum to less than 1, the remainder is assigned to sets as decided by Vertex AI.If none of the fractions are set, by default roughly 80% of data will be used for training, 10% for validation, and 10% for test.

Args:
dataset:

Vertex AI to fit this training against. Custom training script should retrieve datasets through passed in environment variables uris:

os.environ[“AIP_TRAINING_DATA_URI”] os.environ[“AIP_VALIDATION_DATA_URI”] os.environ[“AIP_TEST_DATA_URI”]

Additionally the dataset format is passed in as:

os.environ[“AIP_DATA_FORMAT”]

annotation_schema_uri:

Google Cloud Storage URI points to a YAML file describing annotation schema. The schema is defined as an OpenAPI 3.0.2 [Schema Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schema-object) The schema files that can be used here are found in gs://google-cloud-aiplatform/schema/dataset/annotation/, note that the chosen schema must be consistent with metadata of the Dataset specified by dataset_id.

Only Annotations that both match this schema and belong to DataItems not ignored by the split method are used in respectively training, validation or test role, depending on the role of the DataItem they are on.

When used in conjunction with annotations_filter, the Annotations used for training are filtered by both annotations_filter and annotation_schema_uri.

model_display_name:

If the script produces a managed Vertex AI Model. The display name of the Model. The name can be up to 128 characters long and can be consist of any UTF-8 characters.

If not provided upon creation, the job’s display_name is used.

base_output_dir:

GCS output directory of job. If not provided a timestamped directory in the staging directory will be used.

Vertex AI sets the following environment variables when it runs your training code:

  • AIP_MODEL_DIR: a Cloud Storage URI of a directory intended for saving model artifacts, i.e. <base_output_dir>/model/

  • AIP_CHECKPOINT_DIR: a Cloud Storage URI of a directory intended for saving checkpoints, i.e. <base_output_dir>/checkpoints/

  • AIP_TENSORBOARD_LOG_DIR: a Cloud Storage URI of a directory intended for saving TensorBoard logs, i.e. <base_output_dir>/logs/

service_account:

Specifies the service account for workload run-as account. Users submitting jobs must have act-as permission on this run-as account.

network:

The full name of the Compute Engine network to which the job should be peered. For example, projects/12345/global/networks/myVPC. Private services access must already be configured for the network. If left unspecified, the job is not peered with any network.

bigquery_destination:

Provide this field if dataset is a BiqQuery dataset. The BigQuery project location where the training data is to be written to. In the given project a new dataset is created with name dataset_<dataset-id>_<annotation-type>_<timestamp-of-training-call> where timestamp is in YYYY_MM_DDThh_mm_ss_sssZ format. All training input data will be written into that dataset. In the dataset three tables will be created, training, validation and test.

  • AIP_DATA_FORMAT = “bigquery”.

  • AIP_TRAINING_DATA_URI =”bigquery_destination.dataset_*.training”

  • AIP_VALIDATION_DATA_URI = “bigquery_destination.dataset_*.validation”

  • AIP_TEST_DATA_URI = “bigquery_destination.dataset_*.test”

args:

Command line arguments to be passed to the Python script.

environment_variables:

Environment variables to be passed to the container. Should be a dictionary where keys are environment variable names and values are environment variable values for those names. At most 10 environment variables can be specified. The Name of the environment variable must be unique.

environment_variables = {

‘MY_KEY’: ‘MY_VALUE’

}

replica_count:

The number of worker replicas. If replica count = 1 then one chief replica will be provisioned. If replica_count > 1 the remainder will be provisioned as a worker replica pool.

machine_type:

The type of machine to use for training.

accelerator_type:

Hardware accelerator type. One of ACCELERATOR_TYPE_UNSPECIFIED, NVIDIA_TESLA_K80, NVIDIA_TESLA_P100, NVIDIA_TESLA_V100, NVIDIA_TESLA_P4, NVIDIA_TESLA_T4

accelerator_count:

The number of accelerators to attach to a worker replica.

training_fraction_split:

The fraction of the input data that is to be used to train the Model. This is ignored if Dataset is not provided.

validation_fraction_split:

The fraction of the input data that is to be used to validate the Model. This is ignored if Dataset is not provided.

test_fraction_split:

The fraction of the input data that is to be used to evaluate the Model. This is ignored if Dataset is not provided.

predefined_split_column_name:

Optional. The key is a name of one of the Dataset’s data columns. The value of the key (either the label’s value or value in the column) must be one of {training, validation, test}, and it defines to which set the given piece of data is assigned. If for a piece of data the key is not present or has an invalid value, that piece is ignored by the pipeline.

Supported only for tabular and time series Datasets.

tensorboard:

Optional. The name of a Vertex AI [Tensorboard][google.cloud.aiplatform.v1beta1.Tensorboard] resource to which this CustomJob will upload Tensorboard logs. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}

The training script should write Tensorboard to following Vertex AI environment variable:

AIP_TENSORBOARD_LOG_DIR

service_account is required with provided tensorboard. For more information on configuring your service account please visit: https://cloud.google.com/vertex-ai/docs/experiments/tensorboard-training

display_name:

Required. The user-defined name of this TrainingPipeline.

python_package_gcs_uri:

Required: GCS location of the training python package.

container_uri:

Required: Uri of the training container image in the GCR.

model_serving_container_image_uri:

If the training produces a managed Vertex AI Model, the URI of the Model serving container suitable for serving the model produced by the training script.

model_serving_container_predict_route:

If the training produces a managed Vertex AI Model, 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.

model_serving_container_health_route:

If the training produces a managed Vertex AI Model, 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 AI Platform.

model_serving_container_command:

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.

model_serving_container_args:

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.

model_serving_container_environment_variables:

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.

model_serving_container_ports:

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.

model_description:

The description of the Model.

model_instance_schema_uri:

Optional. Points to a YAML file stored on Google Cloud Storage describing the format of a single instance, which are used in PredictRequest.instances, ExplainRequest.instances and BatchPredictionJob.input_config. The schema is defined as an OpenAPI 3.0.2 Schema Object. AutoML Models always have this field populated by AI Platform. Note: The URI given on output will be immutable and probably different, including the URI scheme, than the one given on input. The output URI will point to a location where the user only has a read access.

model_parameters_schema_uri:

Optional. Points to a YAML file stored on Google Cloud Storage describing the parameters of prediction and explanation via PredictRequest.parameters, ExplainRequest.parameters and BatchPredictionJob.model_parameters. The schema is defined as an OpenAPI 3.0.2 Schema Object. AutoML Models always have this field populated by AI Platform, if no parameters are supported it is set to an empty string. Note: The URI given on output will be immutable and probably different, including the URI scheme, than the one given on input. The output URI will point to a location where the user only has a read access.

model_prediction_schema_uri:

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 PredictResponse.predictions, ExplainResponse.explanations, and BatchPredictionJob.output_config. The schema is defined as an OpenAPI 3.0.2 Schema Object. AutoML Models always have this field populated by AI Platform. Note: The URI given on output will be immutable and probably different, including the URI scheme, than the one given on input. The output URI will point to a location where the user only has a read access.

project:

Project to run training in. Overrides project set in aiplatform.init.

location:

Location to run training in. Overrides location set in aiplatform.init.

training_encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the training pipeline. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, this TrainingPipeline will be secured by this key.

Note: Model trained by this TrainingPipeline is also secured by this key if model_to_upload is not set separately.

Overrides encryption_spec_key_name set in aiplatform.init.

model_encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the model. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, the trained Model will be secured by this key.

Overrides encryption_spec_key_name set in aiplatform.init.

staging_bucket:

Bucket used to stage source and training artifacts. Overrides staging_bucket set in aiplatform.init.

Returns:

The trained Vertex AI Model resource or None if training did not produce a Vertex AI Model.

google_cloud_pipeline_components.aiplatform.EndpointCreateOp(display_name: str, description: Optional[str] = None, labels: Optional[Dict] = None, metadata: Optional[Sequence[Tuple[str, str]]] = (), project: Optional[str] = None, location: Optional[str] = None, encryption_spec_key_name: Optional[str] = None) Endpoint

Creates a new endpoint.

Args:
display_name:

Required. The user-defined name of the Endpoint. The name can be up to 128 characters long and can be consist of any UTF-8 characters.

description:

Optional. The description of the Endpoint.

labels:

Optional. The labels with user-defined metadata to organize your Endpoints. 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.

metadata:

Optional. Strings which should be sent along with the request as metadata.

project:

Required. Project to retrieve endpoint from. If not set, project set in aiplatform.init will be used.

location:

Required. Location to retrieve endpoint from. If not set, location set in aiplatform.init will be used.

encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the model. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, this Endpoint and all sub-resources of this Endpoint will be secured by this key.

Overrides encryption_spec_key_name set in aiplatform.init.

Returns:

endpoint (endpoint.Endpoint): Created endpoint.

google_cloud_pipeline_components.aiplatform.ImageDatasetCreateOp(display_name: str, gcs_source: Optional[Union[str, Sequence[str]]] = None, import_schema_uri: Optional[str] = None, data_item_labels: Optional[Dict] = None, project: Optional[str] = None, location: Optional[str] = None, request_metadata: Optional[Sequence[Tuple[str, str]]] = (), encryption_spec_key_name: Optional[str] = None) ImageDataset

Creates a new image dataset and optionally imports data into dataset when source and import_schema_uri are passed.

Args:
display_name:

Required. The user-defined name of the Dataset. The name can be up to 128 characters long and can be consist of any UTF-8 characters.

gcs_source:

Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. For more information on wildcards, see https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames. examples:

str: “gs://bucket/file.csv” Sequence[str]: [“gs://bucket/file1.csv”, “gs://bucket/file2.csv”]

import_schema_uri:

Points to a YAML file stored on Google Cloud Storage describing the import format. Validation will be done against the schema. The schema is defined as an OpenAPI 3.0.2 Schema Object.

data_item_labels:

Labels that will be applied to newly imported DataItems. If an identical DataItem as one being imported already exists in the Dataset, then these labels will be appended to these of the already existing one, and if labels with identical key is imported before, the old label value will be overwritten. If two DataItems are identical in the same import data operation, the labels will be combined and if key collision happens in this case, one of the values will be picked randomly. Two DataItems are considered identical if their content bytes are identical (e.g. image bytes or pdf bytes). These labels will be overridden by Annotation labels specified inside index file refenced by import_schema_uri, e.g. jsonl file.

project:

Project to upload this model to. Overrides project set in aiplatform.init.

location:

Location to upload this model to. Overrides location set in aiplatform.init.

request_metadata:

Strings which should be sent along with the request as metadata.

encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the dataset. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, this Dataset and all sub-resources of this Dataset will be secured by this key.

Overrides encryption_spec_key_name set in aiplatform.init.

Returns:

image_dataset (ImageDataset): Instantiated representation of the managed image dataset resource.

google_cloud_pipeline_components.aiplatform.ImageDatasetExportDataOp(dataset: google.cloud.aiplatform.datasets.image_dataset.ImageDataset, output_dir: str, project: Optional[str] = None, location: Optional[str] = None) Sequence[str]

Exports data to output dir to GCS.

Args:
output_dir:

Required. The Google Cloud Storage location where the output is to be written to. In the given directory a new directory will be created with name: export-data-<dataset-display-name>-<timestamp-of-export-call> where timestamp is in YYYYMMDDHHMMSS format. All export output will be written into that directory. Inside that directory, annotations with the same schema will be grouped into sub directories which are named with the corresponding annotations’ schema title. Inside these sub directories, a schema.yaml will be created to describe the output format.

If the uri doesn’t end with ‘/’, a ‘/’ will be automatically appended. The directory is created if it doesn’t exist.

project:

Optional project to retrieve dataset from. If not set, project set in aiplatform.init will be used.

location:

Optional location to retrieve dataset from. If not set, location set in aiplatform.init will be used.

Returns:

exported_files (Sequence[str]): All of the files that are exported in this export operation.

google_cloud_pipeline_components.aiplatform.ImageDatasetImportDataOp(dataset: google.cloud.aiplatform.datasets.image_dataset.ImageDataset, gcs_source: Union[str, Sequence[str]], import_schema_uri: str, project: Optional[str] = None, location: Optional[str] = None, data_item_labels: Optional[Dict] = None) _Dataset

Upload data to existing managed dataset.

Args:
gcs_source:

Required. Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. For more information on wildcards, see https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames. examples:

str: “gs://bucket/file.csv” Sequence[str]: [“gs://bucket/file1.csv”, “gs://bucket/file2.csv”]

import_schema_uri:

Required. Points to a YAML file stored on Google Cloud Storage describing the import format. Validation will be done against the schema. The schema is defined as an OpenAPI 3.0.2 Schema Object.

data_item_labels:

Labels that will be applied to newly imported DataItems. If an identical DataItem as one being imported already exists in the Dataset, then these labels will be appended to these of the already existing one, and if labels with identical key is imported before, the old label value will be overwritten. If two DataItems are identical in the same import data operation, the labels will be combined and if key collision happens in this case, one of the values will be picked randomly. Two DataItems are considered identical if their content bytes are identical (e.g. image bytes or pdf bytes). These labels will be overridden by Annotation labels specified inside index file refenced by import_schema_uri, e.g. jsonl file.

project:

Optional project to retrieve dataset from. If not set, project set in aiplatform.init will be used.

location:

Optional location to retrieve dataset from. If not set, location set in aiplatform.init will be used.

Returns:

dataset (Dataset): Instantiated representation of the managed dataset resource.

google_cloud_pipeline_components.aiplatform.ModelBatchPredictOp(model: google.cloud.aiplatform.models.Model, job_display_name: str, project: Optional[str] = None, location: Optional[str] = None, gcs_source: Optional[Union[str, Sequence[str]]] = None, bigquery_source: Optional[str] = None, instances_format: str = 'jsonl', gcs_destination_prefix: Optional[str] = None, bigquery_destination_prefix: Optional[str] = None, predictions_format: str = 'jsonl', model_parameters: Optional[Dict] = None, machine_type: Optional[str] = None, accelerator_type: Optional[str] = None, accelerator_count: Optional[int] = None, starting_replica_count: Optional[int] = None, max_replica_count: Optional[int] = None, generate_explanation: Optional[bool] = False, explanation_metadata: Optional[google.cloud.aiplatform_v1beta1.types.explanation_metadata.ExplanationMetadata] = None, explanation_parameters: Optional[google.cloud.aiplatform_v1beta1.types.explanation.ExplanationParameters] = None, labels: Optional[dict] = None, encryption_spec_key_name: Optional[str] = None) google.cloud.aiplatform.jobs.BatchPredictionJob

Creates a batch prediction job using this Model and outputs prediction results to the provided destination prefix in the specified predictions_format. One source and one destination prefix are required.

Example usage:

my_model.batch_predict(

job_display_name=”prediction-123”, gcs_source=”gs://example-bucket/instances.csv”, instances_format=”csv”, bigquery_destination_prefix=”projectId.bqDatasetId.bqTableId”

)

Args:
job_display_name:

Required. The user-defined name of the BatchPredictionJob. The name can be up to 128 characters long and can be consist of any UTF-8 characters.

gcs_source:

Optional[Sequence[str]] = None Google Cloud Storage URI(-s) to your instances to run batch prediction on. They must match instances_format. May contain wildcards. For more information on wildcards, see https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.

bigquery_source:

Optional[str] = None BigQuery URI to a table, up to 2000 characters long. For example: projectId.bqDatasetId.bqTableId

instances_format:

str = “jsonl” Required. The format in which instances are given, must be one of “jsonl”, “csv”, “bigquery”, “tf-record”, “tf-record-gzip”, or “file-list”. Default is “jsonl” when using gcs_source. If a bigquery_source is provided, this is overridden to “bigquery”.

gcs_destination_prefix:

Optional[str] = None The Google Cloud Storage location of the directory where the output is to be written to. In the given directory a new directory is created. Its name is prediction-<model-display-name>-<job-create-time>, where timestamp is in YYYY-MM-DDThh:mm:ss.sssZ ISO-8601 format. Inside of it files predictions_0001.<extension>, predictions_0002.<extension>, …, predictions_N.<extension> are created where <extension> depends on chosen predictions_format, and N may equal 0001 and depends on the total number of successfully predicted instances. If the Model has both instance and prediction schemata defined then each such file contains predictions as per the predictions_format. If prediction for any instance failed (partially or completely), then an additional errors_0001.<extension>, errors_0002.<extension>,…, errors_N.<extension> files are created (N depends on total number of failed predictions). These files contain the failed instances, as per their schema, followed by an additional error field which as value has `google.rpc.Status <Status>`__ containing only code and message fields.

bigquery_destination_prefix:

Optional[str] = None The BigQuery project location where the output is to be written to. In the given project a new dataset is created with name prediction_<model-display-name>_<job-create-time> where is made BigQuery-dataset-name compatible (for example, most special characters become underscores), and timestamp is in YYYY_MM_DDThh_mm_ss_sssZ “based on ISO-8601” format. In the dataset two tables will be created, predictions, and errors. If the Model has both instance and prediction schemata defined then the tables have columns as follows: The predictions table contains instances for which the prediction succeeded, it has columns as per a concatenation of the Model’s instance and prediction schemata. The errors table contains rows for which the prediction has failed, it has instance columns, as per the instance schema, followed by a single “errors” column, which as values has `google.rpc.Status <Status>`__ represented as a STRUCT, and containing only code and message.

predictions_format:

str = “jsonl” Required. The format in which Vertex AI gives the predictions, must be one of “jsonl”, “csv”, or “bigquery”. Default is “jsonl” when using gcs_destination_prefix. If a bigquery_destination_prefix is provided, this is overridden to “bigquery”.

model_parameters:

Optional[Dict] = None Optional. The parameters that govern the predictions. The schema of the parameters may be specified via the Model’s parameters_schema_uri.

machine_type:

Optional[str] = None Optional. The type of machine for running batch prediction on dedicated resources. Not specifying machine type will result in batch prediction job being run with automatic resources.

accelerator_type:

Optional[str] = None Optional. The type of accelerator(s) that may be attached to the machine as per accelerator_count. Only used if machine_type is set.

accelerator_count:

Optional[int] = None Optional. The number of accelerators to attach to the machine_type. Only used if machine_type is set.

starting_replica_count:

Optional[int] = None The number of machine replicas used at the start of the batch operation. If not set, Vertex AI decides starting number, not greater than max_replica_count. Only used if machine_type is set.

max_replica_count:

Optional[int] = None The maximum number of machine replicas the batch operation may be scaled to. Only used if machine_type is set. Default is 10.

generate_explanation:

Optional. Generate explanation along with the batch prediction results. This will cause the batch prediction output to include explanations based on the prediction_format:

  • bigquery: output includes a column named explanation. The value

    is a struct that conforms to the [aiplatform.gapic.Explanation] object.

  • jsonl: The JSON objects on each line include an additional entry

    keyed explanation. The value of the entry is a JSON object that conforms to the [aiplatform.gapic.Explanation] object.

  • csv: Generating explanations for CSV format is not supported.

explanation_metadata:

Optional. Explanation metadata configuration for this BatchPredictionJob. Can be specified only if generate_explanation is set to True.

This value overrides the value of Model.explanation_metadata. All fields of explanation_metadata are optional in the request. If a field of the explanation_metadata object is not populated, the corresponding field of the Model.explanation_metadata object is inherited. For more details, see Ref docs <http://tinyurl.com/1igh60kt>

explanation_parameters:

Optional. Parameters to configure explaining for Model’s predictions. Can be specified only if generate_explanation is set to True.

This value overrides the value of Model.explanation_parameters. All fields of explanation_parameters are optional in the request. If a field of the explanation_parameters object is not populated, the corresponding field of the Model.explanation_parameters object is inherited. For more details, see Ref docs <http://tinyurl.com/1an4zake>

labels:

Optional[dict] = None Optional. The labels with user-defined metadata to organize your BatchPredictionJobs. 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.

encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the model. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, this Model and all sub-resources of this Model will be secured by this key.

Overrides encryption_spec_key_name set in aiplatform.init.

project:

Optional project to retrieve model from. If not set, project set in aiplatform.init will be used.

location:

Optional location to retrieve model from. If not set, location set in aiplatform.init will be used.

Returns:

Instantiated representation of the created batch prediction job.

google_cloud_pipeline_components.aiplatform.ModelDeployOp(model: google.cloud.aiplatform.models.Model, project: Optional[str] = None, location: Optional[str] = None, endpoint: Optional[Endpoint] = None, deployed_model_display_name: Optional[str] = None, traffic_percentage: Optional[int] = 0, traffic_split: Optional[Dict[str, int]] = None, machine_type: Optional[str] = None, min_replica_count: int = 1, max_replica_count: int = 1, accelerator_type: Optional[str] = None, accelerator_count: Optional[int] = None, service_account: Optional[str] = None, explanation_metadata: Optional[google.cloud.aiplatform_v1beta1.types.explanation_metadata.ExplanationMetadata] = None, explanation_parameters: Optional[google.cloud.aiplatform_v1beta1.types.explanation.ExplanationParameters] = None, metadata: Optional[Sequence[Tuple[str, str]]] = (), encryption_spec_key_name: Optional[str] = None) google.cloud.aiplatform.models.Endpoint

Deploys model to endpoint. Endpoint will be created if unspecified.

Args:
endpoint:

Optional. Endpoint to deploy model to. If not specified, endpoint display name will be model display name+’_endpoint’.

deployed_model_display_name:

Optional. The display name of the DeployedModel. If not provided upon creation, the Model’s display_name is used.

traffic_percentage:

Optional. Desired traffic to newly deployed model. Defaults to 0 if there are pre-existing deployed models. Defaults to 100 if there are no pre-existing deployed models. Negative values should not be provided. Traffic of previously deployed models at the endpoint will be scaled down to accommodate new deployed model’s traffic. Should not be provided if traffic_split is provided.

traffic_split:

Optional. A map from a DeployedModel’s ID to the percentage of this Endpoint’s traffic that should be forwarded to that DeployedModel. If a DeployedModel’s ID is not listed in this map, then it receives no traffic. The traffic percentage values must add up to 100, or map must be empty if the Endpoint is to not accept any traffic at the moment. Key for model being deployed is “0”. Should not be provided if traffic_percentage is provided.

machine_type:

Optional. The type of machine. Not specifying machine type will result in model to be deployed with automatic resources.

min_replica_count:

Optional. The minimum number of machine replicas this deployed model will be always deployed on. If traffic against it increases, it may dynamically be deployed onto more replicas, and as traffic decreases, some of these extra replicas may be freed.

max_replica_count:

Optional. The maximum number of replicas this deployed model may be deployed on when the traffic against it increases. If requested value is too large, the deployment will error, but if deployment succeeds then the ability to scale the model to that many replicas is guaranteed (barring service outages). If traffic against the deployed model increases beyond what its replicas at maximum may handle, a portion of the traffic will be dropped. If this value is not provided, the smaller value of min_replica_count or 1 will be used.

accelerator_type:

Optional. Hardware accelerator type. Must also set accelerator_count if used. One of ACCELERATOR_TYPE_UNSPECIFIED, NVIDIA_TESLA_K80, NVIDIA_TESLA_P100, NVIDIA_TESLA_V100, NVIDIA_TESLA_P4, NVIDIA_TESLA_T4

accelerator_count:

Optional. The number of accelerators to attach to a worker replica.

service_account:

The service account that the DeployedModel’s container runs as. Specify the email address of the service account. If this service account is not specified, the container runs as a service account that doesn’t have access to the resource project. Users deploying the Model must have the iam.serviceAccounts.actAs permission on this service account.

explanation_metadata:

Optional. Metadata describing the Model’s input and output for explanation. Both explanation_metadata and explanation_parameters must be passed together when used. For more details, see Ref docs <http://tinyurl.com/1igh60kt>

explanation_parameters:

Optional. Parameters to configure explaining for Model’s predictions. For more details, see Ref docs <http://tinyurl.com/1an4zake>

metadata:

Optional. Strings which should be sent along with the request as metadata.

encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the model. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, this Model and all sub-resources of this Model will be secured by this key.

Overrides encryption_spec_key_name set in aiplatform.init

project:

Optional project to retrieve model from. If not set, project set in aiplatform.init will be used.

location:

Optional location to retrieve model from. If not set, location set in aiplatform.init will be used.

Returns:

endpoint (“Endpoint”): Endpoint with the deployed model.

google_cloud_pipeline_components.aiplatform.ModelUploadOp(display_name: str, serving_container_image_uri: str, *, artifact_uri: Optional[str] = None, serving_container_predict_route: Optional[str] = None, serving_container_health_route: Optional[str] = None, description: 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_v1beta1.types.explanation_metadata.ExplanationMetadata] = None, explanation_parameters: Optional[google.cloud.aiplatform_v1beta1.types.explanation.ExplanationParameters] = None, project: Optional[str] = None, location: Optional[str] = None, encryption_spec_key_name: Optional[str] = None) Model

Uploads a model and returns a Model representing the uploaded Model resource.

Example usage:

my_model = Model.upload(

display_name=’my-model’, artifact_uri=’gs://my-model/saved-model’ serving_container_image_uri=’tensorflow/serving’

)

Args:
display_name:

Required. The display name of the Model. The name can be up to 128 characters long and can be consist of any UTF-8 characters.

serving_container_image_uri:

Required. The URI of the Model serving container.

artifact_uri:

Optional. The path to the directory containing the Model artifact and any of its supporting files. Leave blank for custom container prediction. Not present for AutoML Models.

serving_container_predict_route:

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:

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.

description:

The description of the model.

serving_container_command:

Optional[Sequence[str]]=None, 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:

Optional[Sequence[str]]=None, 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:

Optional[Dict[str, str]]=None, 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:

Optional[Sequence[int]]=None, 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:

Optional. Points to a YAML file stored on Google Cloud Storage describing the format of a single instance, which are used in PredictRequest.instances, ExplainRequest.instances and BatchPredictionJob.input_config. The schema is defined as an OpenAPI 3.0.2 Schema Object. AutoML Models always have this field populated by AI Platform. Note: The URI given on output will be immutable and probably different, including the URI scheme, than the one given on input. The output URI will point to a location where the user only has a read access.

parameters_schema_uri:

Optional. Points to a YAML file stored on Google Cloud Storage describing the parameters of prediction and explanation via PredictRequest.parameters, ExplainRequest.parameters and BatchPredictionJob.model_parameters. The schema is defined as an OpenAPI 3.0.2 Schema Object. AutoML Models always have this field populated by AI Platform, if no parameters are supported it is set to an empty string. Note: The URI given on output will be immutable and probably different, including the URI scheme, than the one given on input. The output URI will point to a location where the user only has a read access.

prediction_schema_uri:

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 PredictResponse.predictions, ExplainResponse.explanations, and BatchPredictionJob.output_config. The schema is defined as an OpenAPI 3.0.2 Schema Object. AutoML Models always have this field populated by AI Platform. Note: The URI given on output will be immutable and probably different, including the URI scheme, than the one given on input. The output URI will point to a location where the user only has a read access.

explanation_metadata:

Optional. Metadata describing the Model’s input and output for explanation. Both explanation_metadata and explanation_parameters must be passed together when used. For more details, see Ref docs <http://tinyurl.com/1igh60kt>

explanation_parameters:

Optional. Parameters to configure explaining for Model’s predictions. For more details, see Ref docs <http://tinyurl.com/1an4zake>

project:

Optional[str]=None, Project to upload this model to. Overrides project set in aiplatform.init.

location:

Optional[str]=None, Location to upload this model to. Overrides location set in aiplatform.init.

encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the model. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, this Model and all sub-resources of this Model will be secured by this key.

Overrides encryption_spec_key_name set in aiplatform.init.

Returns:

Instantiated representation of the uploaded model resource.

Raises:
ValueError:

If only explanation_metadata or explanation_parameters is specified.

google_cloud_pipeline_components.aiplatform.TabularDatasetCreateOp(display_name: str, gcs_source: Optional[Union[str, Sequence[str]]] = None, bq_source: Optional[str] = None, project: Optional[str] = None, location: Optional[str] = None, request_metadata: Optional[Sequence[Tuple[str, str]]] = (), encryption_spec_key_name: Optional[str] = None) TabularDataset

Creates a new tabular dataset.

Args:
display_name:

Required. The user-defined name of the Dataset. The name can be up to 128 characters long and can be consist of any UTF-8 characters.

gcs_source:

Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. For more information on wildcards, see https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames. examples:

str: “gs://bucket/file.csv” Sequence[str]: [“gs://bucket/file1.csv”, “gs://bucket/file2.csv”]

bq_source:

BigQuery URI to the input table. example:

“bq://project.dataset.table_name”

project:

Project to upload this model to. Overrides project set in aiplatform.init.

location:

Location to upload this model to. Overrides location set in aiplatform.init.

request_metadata:

Strings which should be sent along with the request as metadata.

encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the dataset. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, this Dataset and all sub-resources of this Dataset will be secured by this key.

Overrides encryption_spec_key_name set in aiplatform.init.

Returns:

tabular_dataset (TabularDataset): Instantiated representation of the managed tabular dataset resource.

google_cloud_pipeline_components.aiplatform.TabularDatasetExportDataOp(dataset: google.cloud.aiplatform.datasets.tabular_dataset.TabularDataset, output_dir: str, project: Optional[str] = None, location: Optional[str] = None) Sequence[str]

Exports data to output dir to GCS.

Args:
output_dir:

Required. The Google Cloud Storage location where the output is to be written to. In the given directory a new directory will be created with name: export-data-<dataset-display-name>-<timestamp-of-export-call> where timestamp is in YYYYMMDDHHMMSS format. All export output will be written into that directory. Inside that directory, annotations with the same schema will be grouped into sub directories which are named with the corresponding annotations’ schema title. Inside these sub directories, a schema.yaml will be created to describe the output format.

If the uri doesn’t end with ‘/’, a ‘/’ will be automatically appended. The directory is created if it doesn’t exist.

project:

Optional project to retrieve dataset from. If not set, project set in aiplatform.init will be used.

location:

Optional location to retrieve dataset from. If not set, location set in aiplatform.init will be used.

Returns:

exported_files (Sequence[str]): All of the files that are exported in this export operation.

google_cloud_pipeline_components.aiplatform.TextDatasetCreateOp(display_name: str, gcs_source: Optional[Union[str, Sequence[str]]] = None, import_schema_uri: Optional[str] = None, data_item_labels: Optional[Dict] = None, project: Optional[str] = None, location: Optional[str] = None, request_metadata: Optional[Sequence[Tuple[str, str]]] = (), encryption_spec_key_name: Optional[str] = None) TextDataset

Creates a new text dataset and optionally imports data into dataset when source and import_schema_uri are passed.

Example Usage:
ds = aiplatform.TextDataset.create(

display_name=’my-dataset’, gcs_source=’gs://my-bucket/dataset.csv’, import_schema_uri=aiplatform.schema.dataset.ioformat.text.multi_label_classification

)

Args:
display_name:

Required. The user-defined name of the Dataset. The name can be up to 128 characters long and can be consist of any UTF-8 characters.

gcs_source:

Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. For more information on wildcards, see https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames. examples:

str: “gs://bucket/file.csv” Sequence[str]: [“gs://bucket/file1.csv”, “gs://bucket/file2.csv”]

import_schema_uri:

Points to a YAML file stored on Google Cloud Storage describing the import format. Validation will be done against the schema. The schema is defined as an OpenAPI 3.0.2 Schema Object.

data_item_labels:

Labels that will be applied to newly imported DataItems. If an identical DataItem as one being imported already exists in the Dataset, then these labels will be appended to these of the already existing one, and if labels with identical key is imported before, the old label value will be overwritten. If two DataItems are identical in the same import data operation, the labels will be combined and if key collision happens in this case, one of the values will be picked randomly. Two DataItems are considered identical if their content bytes are identical (e.g. image bytes or pdf bytes). These labels will be overridden by Annotation labels specified inside index file refenced by import_schema_uri, e.g. jsonl file.

project:

Project to upload this model to. Overrides project set in aiplatform.init.

location:

Location to upload this model to. Overrides location set in aiplatform.init.

request_metadata:

Strings which should be sent along with the request as metadata.

encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the dataset. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, this Dataset and all sub-resources of this Dataset will be secured by this key.

Overrides encryption_spec_key_name set in aiplatform.init.

Returns:

text_dataset (TextDataset): Instantiated representation of the managed text dataset resource.

google_cloud_pipeline_components.aiplatform.TextDatasetExportDataOp(dataset: google.cloud.aiplatform.datasets.text_dataset.TextDataset, output_dir: str, project: Optional[str] = None, location: Optional[str] = None) Sequence[str]

Exports data to output dir to GCS.

Args:
output_dir:

Required. The Google Cloud Storage location where the output is to be written to. In the given directory a new directory will be created with name: export-data-<dataset-display-name>-<timestamp-of-export-call> where timestamp is in YYYYMMDDHHMMSS format. All export output will be written into that directory. Inside that directory, annotations with the same schema will be grouped into sub directories which are named with the corresponding annotations’ schema title. Inside these sub directories, a schema.yaml will be created to describe the output format.

If the uri doesn’t end with ‘/’, a ‘/’ will be automatically appended. The directory is created if it doesn’t exist.

project:

Optional project to retrieve dataset from. If not set, project set in aiplatform.init will be used.

location:

Optional location to retrieve dataset from. If not set, location set in aiplatform.init will be used.

Returns:

exported_files (Sequence[str]): All of the files that are exported in this export operation.

google_cloud_pipeline_components.aiplatform.TextDatasetImportDataOp(dataset: google.cloud.aiplatform.datasets.text_dataset.TextDataset, gcs_source: Union[str, Sequence[str]], import_schema_uri: str, project: Optional[str] = None, location: Optional[str] = None, data_item_labels: Optional[Dict] = None) _Dataset

Upload data to existing managed dataset.

Args:
gcs_source:

Required. Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. For more information on wildcards, see https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames. examples:

str: “gs://bucket/file.csv” Sequence[str]: [“gs://bucket/file1.csv”, “gs://bucket/file2.csv”]

import_schema_uri:

Required. Points to a YAML file stored on Google Cloud Storage describing the import format. Validation will be done against the schema. The schema is defined as an OpenAPI 3.0.2 Schema Object.

data_item_labels:

Labels that will be applied to newly imported DataItems. If an identical DataItem as one being imported already exists in the Dataset, then these labels will be appended to these of the already existing one, and if labels with identical key is imported before, the old label value will be overwritten. If two DataItems are identical in the same import data operation, the labels will be combined and if key collision happens in this case, one of the values will be picked randomly. Two DataItems are considered identical if their content bytes are identical (e.g. image bytes or pdf bytes). These labels will be overridden by Annotation labels specified inside index file refenced by import_schema_uri, e.g. jsonl file.

project:

Optional project to retrieve dataset from. If not set, project set in aiplatform.init will be used.

location:

Optional location to retrieve dataset from. If not set, location set in aiplatform.init will be used.

Returns:

dataset (Dataset): Instantiated representation of the managed dataset resource.

google_cloud_pipeline_components.aiplatform.TimeSeriesDatasetCreateOp(display_name: str, gcs_source: Optional[Union[str, Sequence[str]]] = None, bq_source: Optional[str] = None, project: Optional[str] = None, location: Optional[str] = None, request_metadata: Optional[Sequence[Tuple[str, str]]] = (), encryption_spec_key_name: Optional[str] = None) TimeSeriesDataset

Creates a new time series dataset.

Args:
display_name:

Required. The user-defined name of the Dataset. The name can be up to 128 characters long and can be consist of any UTF-8 characters.

gcs_source:

Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. For more information on wildcards, see https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames. examples:

str: “gs://bucket/file.csv” Sequence[str]: [“gs://bucket/file1.csv”, “gs://bucket/file2.csv”]

bq_source:

BigQuery URI to the input table. example:

“bq://project.dataset.table_name”

project:

Project to upload this model to. Overrides project set in aiplatform.init.

location:

Location to upload this model to. Overrides location set in aiplatform.init.

request_metadata:

Strings which should be sent along with the request as metadata.

encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the dataset. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, this Dataset and all sub-resources of this Dataset will be secured by this key.

Overrides encryption_spec_key_name set in aiplatform.init.

Returns:

time_series_dataset (TimeSeriesDataset): Instantiated representation of the managed time series dataset resource.

google_cloud_pipeline_components.aiplatform.TimeSeriesDatasetExportDataOp(dataset: google.cloud.aiplatform.datasets.time_series_dataset.TimeSeriesDataset, output_dir: str, project: Optional[str] = None, location: Optional[str] = None) Sequence[str]

Exports data to output dir to GCS.

Args:
output_dir:

Required. The Google Cloud Storage location where the output is to be written to. In the given directory a new directory will be created with name: export-data-<dataset-display-name>-<timestamp-of-export-call> where timestamp is in YYYYMMDDHHMMSS format. All export output will be written into that directory. Inside that directory, annotations with the same schema will be grouped into sub directories which are named with the corresponding annotations’ schema title. Inside these sub directories, a schema.yaml will be created to describe the output format.

If the uri doesn’t end with ‘/’, a ‘/’ will be automatically appended. The directory is created if it doesn’t exist.

project:

Optional project to retrieve dataset from. If not set, project set in aiplatform.init will be used.

location:

Optional location to retrieve dataset from. If not set, location set in aiplatform.init will be used.

Returns:

exported_files (Sequence[str]): All of the files that are exported in this export operation.

google_cloud_pipeline_components.aiplatform.VideoDatasetCreateOp(display_name: str, gcs_source: Optional[Union[str, Sequence[str]]] = None, import_schema_uri: Optional[str] = None, data_item_labels: Optional[Dict] = None, project: Optional[str] = None, location: Optional[str] = None, request_metadata: Optional[Sequence[Tuple[str, str]]] = (), encryption_spec_key_name: Optional[str] = None) VideoDataset

Creates a new video dataset and optionally imports data into dataset when source and import_schema_uri are passed.

Args:
display_name:

Required. The user-defined name of the Dataset. The name can be up to 128 characters long and can be consist of any UTF-8 characters.

gcs_source:

Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. For more information on wildcards, see https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames. examples:

str: “gs://bucket/file.csv” Sequence[str]: [“gs://bucket/file1.csv”, “gs://bucket/file2.csv”]

import_schema_uri:

Points to a YAML file stored on Google Cloud Storage describing the import format. Validation will be done against the schema. The schema is defined as an OpenAPI 3.0.2 Schema Object.

data_item_labels:

Labels that will be applied to newly imported DataItems. If an identical DataItem as one being imported already exists in the Dataset, then these labels will be appended to these of the already existing one, and if labels with identical key is imported before, the old label value will be overwritten. If two DataItems are identical in the same import data operation, the labels will be combined and if key collision happens in this case, one of the values will be picked randomly. Two DataItems are considered identical if their content bytes are identical (e.g. image bytes or pdf bytes). These labels will be overridden by Annotation labels specified inside index file refenced by import_schema_uri, e.g. jsonl file.

project:

Project to upload this model to. Overrides project set in aiplatform.init.

location:

Location to upload this model to. Overrides location set in aiplatform.init.

request_metadata:

Strings which should be sent along with the request as metadata.

encryption_spec_key_name:

Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the dataset. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.

If set, this Dataset and all sub-resources of this Dataset will be secured by this key.

Overrides encryption_spec_key_name set in aiplatform.init.

Returns:

video_dataset (VideoDataset): Instantiated representation of the managed video dataset resource.

google_cloud_pipeline_components.aiplatform.VideoDatasetExportDataOp(dataset: google.cloud.aiplatform.datasets.video_dataset.VideoDataset, output_dir: str, project: Optional[str] = None, location: Optional[str] = None) Sequence[str]

Exports data to output dir to GCS.

Args:
output_dir:

Required. The Google Cloud Storage location where the output is to be written to. In the given directory a new directory will be created with name: export-data-<dataset-display-name>-<timestamp-of-export-call> where timestamp is in YYYYMMDDHHMMSS format. All export output will be written into that directory. Inside that directory, annotations with the same schema will be grouped into sub directories which are named with the corresponding annotations’ schema title. Inside these sub directories, a schema.yaml will be created to describe the output format.

If the uri doesn’t end with ‘/’, a ‘/’ will be automatically appended. The directory is created if it doesn’t exist.

project:

Optional project to retrieve dataset from. If not set, project set in aiplatform.init will be used.

location:

Optional location to retrieve dataset from. If not set, location set in aiplatform.init will be used.

Returns:

exported_files (Sequence[str]): All of the files that are exported in this export operation.

google_cloud_pipeline_components.aiplatform.VideoDatasetImportDataOp(dataset: google.cloud.aiplatform.datasets.video_dataset.VideoDataset, gcs_source: Union[str, Sequence[str]], import_schema_uri: str, project: Optional[str] = None, location: Optional[str] = None, data_item_labels: Optional[Dict] = None) _Dataset

Upload data to existing managed dataset.

Args:
gcs_source:

Required. Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. For more information on wildcards, see https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames. examples:

str: “gs://bucket/file.csv” Sequence[str]: [“gs://bucket/file1.csv”, “gs://bucket/file2.csv”]

import_schema_uri:

Required. Points to a YAML file stored on Google Cloud Storage describing the import format. Validation will be done against the schema. The schema is defined as an OpenAPI 3.0.2 Schema Object.

data_item_labels:

Labels that will be applied to newly imported DataItems. If an identical DataItem as one being imported already exists in the Dataset, then these labels will be appended to these of the already existing one, and if labels with identical key is imported before, the old label value will be overwritten. If two DataItems are identical in the same import data operation, the labels will be combined and if key collision happens in this case, one of the values will be picked randomly. Two DataItems are considered identical if their content bytes are identical (e.g. image bytes or pdf bytes). These labels will be overridden by Annotation labels specified inside index file refenced by import_schema_uri, e.g. jsonl file.

project:

Optional project to retrieve dataset from. If not set, project set in aiplatform.init will be used.

location:

Optional location to retrieve dataset from. If not set, location set in aiplatform.init will be used.

Returns:

dataset (Dataset): Instantiated representation of the managed dataset resource.