- 1.63.0 (latest)
- 1.62.0
- 1.60.0
- 1.59.0
- 1.58.0
- 1.57.0
- 1.56.0
- 1.55.0
- 1.54.1
- 1.53.0
- 1.52.0
- 1.51.0
- 1.50.0
- 1.49.0
- 1.48.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.39.0
- 1.38.1
- 1.37.0
- 1.36.4
- 1.35.0
- 1.34.0
- 1.33.1
- 1.32.0
- 1.31.1
- 1.30.1
- 1.29.0
- 1.28.1
- 1.27.1
- 1.26.1
- 1.25.0
- 1.24.1
- 1.23.0
- 1.22.1
- 1.21.0
- 1.20.0
- 1.19.1
- 1.18.3
- 1.17.1
- 1.16.1
- 1.15.1
- 1.14.0
- 1.13.1
- 1.12.1
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.1
- 1.7.1
- 1.6.2
- 1.5.0
- 1.4.3
- 1.3.0
- 1.2.0
- 1.1.1
- 1.0.1
- 0.9.0
- 0.8.0
- 0.7.1
- 0.6.0
- 0.5.1
- 0.4.0
- 0.3.1
AutoMLImageTrainingJob(
display_name: typing.Optional[str] = None,
prediction_type: str = "classification",
multi_label: bool = False,
model_type: str = "CLOUD",
base_model: typing.Optional[google.cloud.aiplatform.models.Model] = None,
incremental_train_base_model: typing.Optional[
google.cloud.aiplatform.models.Model
] = None,
project: typing.Optional[str] = None,
location: typing.Optional[str] = None,
credentials: typing.Optional[google.auth.credentials.Credentials] = None,
labels: typing.Optional[typing.Dict[str, str]] = None,
training_encryption_spec_key_name: typing.Optional[str] = None,
model_encryption_spec_key_name: typing.Optional[str] = None,
checkpoint_name: typing.Optional[str] = None,
trainer_config: typing.Optional[typing.Dict[str, str]] = None,
metric_spec: typing.Optional[typing.Dict[str, str]] = None,
parameter_spec: typing.Optional[
typing.Dict[
str,
typing.Union[
google.cloud.aiplatform.hyperparameter_tuning.DoubleParameterSpec,
google.cloud.aiplatform.hyperparameter_tuning.IntegerParameterSpec,
google.cloud.aiplatform.hyperparameter_tuning.CategoricalParameterSpec,
google.cloud.aiplatform.hyperparameter_tuning.DiscreteParameterSpec,
],
]
] = None,
search_algorithm: typing.Optional[str] = None,
measurement_selection: typing.Optional[str] = None,
)
Creates an AutoML image training job.
Use the AutoMLImageTrainingJob
class to create, train, and return an
image model. For more information about working with image data models
in Vertex AI, see Image data.
For an example of how to use the AutoMLImageTrainingJob
class, see the
tutorial in the AutoML image
classification
notebook on GitHub.
Parameters |
|
---|---|
Name | Description |
display_name |
str
Optional. The user-defined name of the training pipeline. The name must contain 128 or fewer UTF-8 characters. |
prediction_type |
str
The type of prediction the model produces. Valid values are: |
multi_label |
bool = False
Required. If |
model_type |
str = "CLOUD"
Required. The type of model to create. The following are the valid values: |
base_model |
typing.Optional[google.cloud.aiplatform.models.Model]
Optional[models.Model] = Optional. You can specify a |
incremental_train_base_model |
typing.Optional[google.cloud.aiplatform.models.Model]
Optional[models.Model] = Optional. You can specify an |
project |
str
Optional. The Google Cloud region where this where the training runs. This region overrides the region that was set by |
location |
str
Optional. Location to run training in. Overrides location set in aiplatform.init. |
credentials |
auth_credentials.Credentials
Optional. The credentials that are used to train the model. These credentials override the credentials set by |
labels |
Dict[str, str]
Optional. Labels with user-defined metadata to organize your training pipelines. The maximum length of a key and value is 64 unicode characters. Labels and keys can contain only lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. For more information and examples of using labels, see Using labels to organize Google Cloud Platform resources. |
training_encryption_spec_key_name |
Optional[str]
Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the training pipeline. The key has the following format: |
model_encryption_spec_key_name |
Optional[str]
Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the model. The key has the following format: |
checkpoint_name |
typing.Optional[str]
Optional[str] = Optional. The field is reserved for Model Garden model training and is based on the provided pre-trained model checkpoint. |
trainer_config |
typing.Optional[typing.Dict[str, str]]
Optional[Dict[str, str]] = None, Optional. A field that's used with the Model Garden model training when passing customized configs for the trainer. The following is an example that uses all py trainer_config = { 'global_batch_size': '8', 'learning_rate': '0.001', 'optimizer_type': 'sgd', 'optimizer_momentum': '0.9', 'train_steps': '10000', 'accelerator_count': '1', 'anchor_size': '8', -- IOD only } trainer_config is required for only Model Garden models when model_type is EFFICIENTNET , VIT , COCA , SPINENET , or YOLO .
|
metric_spec |
typing.Optional[typing.Dict[str, str]]
Dict[str, str] Required. A dictionary that represents metrics use for optimization. The dictionary key is the |
parameter_spec |
Dict[str, hpt._ParameterSpec]
Required. A dictionary representing parameters to use for optimization. The dictionary key is the py from google.cloud.aiplatform import hpt as hpt parameter_spec = { 'learning_rate': hpt.DoubleParameterSpec(min=1e-7, max=1, scale='linear'), }Supported parameter specifications can be found in aiplatform.hyperparameter_tuning . The following parameter specifications are supported: Union[DoubleParameterSpec, IntegerParameterSpec, CategoricalParameterSpec, DiscreteParameterSpec] . parameter_spec is required for only Model Garden models when model_type is EFFICIENTNET , VIT , COCA , SPINENET , or YOLO .
|
search_algorithm |
str
The search algorithm that's specified for the study. The search algorithm can be one of the following: |
measurement_selection |
str
Indicates which measurement to use when the service selects the final measurement from previously reported intermediate measurements. |
Properties
create_time
Time this resource was created.
display_name
Display name of this resource.
encryption_spec
Customer-managed encryption key options for this Vertex AI resource.
If this is set, then all resources created by this Vertex AI resource will be encrypted with the provided encryption key.
end_time
Optional. The time when the training job entered the
PIPELINE_STATE_SUCCEEDED
, PIPELINE_STATE_FAILED
, or
PIPELINE_STATE_CANCELLED
state.
error
Optional. Detailed error information for this training job resource.
Error information is created only when the state of the training job is
PIPELINE_STATE_FAILED
or PIPELINE_STATE_CANCELLED
.
gca_resource
The underlying resource proto representation.
has_failed
Returns true
if the training job failed, otherwise false
.
labels
User-defined labels containing metadata about this resource.
Read more about labels at https://goo.gl/xmQnxf
name
Name of this resource.
resource_name
Full qualified resource name.
start_time
Optional. The time when the training job first entered the
PIPELINE_STATE_RUNNING
state.
state
Current training state.
update_time
Time this resource was last updated.
Methods
cancel
cancel() -> None
Asynchronously attempts to cancel a training job.
The server makes a best effort to cancel the job, but the training job
can't always be cancelled. If the training job is canceled, its state
transitions to CANCELLED
and it's not deleted.
Exceptions | |
---|---|
Type | Description |
RuntimeError |
If this training job isn't running, then a runtime error is raised. |
delete
delete(sync: bool = True) -> None
Deletes this Vertex AI resource. WARNING: This deletion is permanent.
Parameter | |
---|---|
Name | Description |
sync |
bool
Whether to execute this deletion 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. |
done
done() -> bool
Method indicating whether a job has completed.
get
get(
resource_name: str,
project: typing.Optional[str] = None,
location: typing.Optional[str] = None,
credentials: typing.Optional[google.auth.credentials.Credentials] = None,
) -> google.cloud.aiplatform.training_jobs._TrainingJob
Gets a training job using the resource_name
that's passed in.
Parameters | |
---|---|
Name | Description |
resource_name |
str
Required. A fully-qualified resource name or ID. |
project |
str
Optional. The name of the Google Cloud project to retrieve the training job from. This overrides the project that was set by |
location |
str
Optional. The Google Cloud region from where the training job is retrieved. This region overrides the region that was set by |
credentials |
auth_credentials.Credentials
Optional. The credentials that are used to upload this model. These credentials override the credentials set by |
Exceptions | |
---|---|
Type | Description |
ValueError |
A ValueError is raised if the task definition of the retrieved training job doesn't match the custom training task definition. |
get_model
get_model(sync=True) -> google.cloud.aiplatform.models.Model
Returns the Vertex AI model produced by this training job.
Parameter | |
---|---|
Name | Description |
sync |
bool
If set to |
Exceptions | |
---|---|
Type | Description |
RuntimeError |
A runtime error is raised if the training job failed or if a model wasn't produced by the training job. |
list
list(
filter: typing.Optional[str] = None,
order_by: typing.Optional[str] = None,
project: typing.Optional[str] = None,
location: typing.Optional[str] = None,
credentials: typing.Optional[google.auth.credentials.Credentials] = None,
) -> typing.List[google.cloud.aiplatform.base.VertexAiResourceNoun]
Lists all instances of this training job resource.
The following shows an example of how to call CustomTrainingJob.list
:
aiplatform.CustomTrainingJob.list(
filter='display_name="experiment_a27"',
order_by='create_time desc'
)
Parameters | |
---|---|
Name | Description |
filter |
str
Optional. An expression for filtering the results of the request. For field names, snake_case and camelCase are supported. |
order_by |
str
Optional. A comma-separated list of fields used to sort the returned traing job resources. The defauilt sorting order is ascending. To sort by a field name in descending order, use |
project |
str
Optional. The name of the Google Cloud project to which to retrieve the list of training job resources. This overrides the project that was set by |
location |
str
Optional. The Google Cloud region from where the training job resources are retrieved. This region overrides the region that was set by |
credentials |
auth_credentials.Credentials
Optional. The credentials that are used to retrieve list. These credentials override the credentials set by |
Returns | |
---|---|
Type | Description |
List[VertexAiResourceNoun] |
A list of training job resources. |
run
run(
dataset: google.cloud.aiplatform.datasets.image_dataset.ImageDataset,
training_fraction_split: typing.Optional[float] = None,
validation_fraction_split: typing.Optional[float] = None,
test_fraction_split: typing.Optional[float] = None,
training_filter_split: typing.Optional[str] = None,
validation_filter_split: typing.Optional[str] = None,
test_filter_split: typing.Optional[str] = None,
budget_milli_node_hours: typing.Optional[int] = None,
model_display_name: typing.Optional[str] = None,
model_labels: typing.Optional[typing.Dict[str, str]] = None,
model_id: typing.Optional[str] = None,
parent_model: typing.Optional[str] = None,
is_default_version: typing.Optional[bool] = True,
model_version_aliases: typing.Optional[typing.Sequence[str]] = None,
model_version_description: typing.Optional[str] = None,
disable_early_stopping: bool = False,
sync: bool = True,
create_request_timeout: typing.Optional[float] = None,
) -> google.cloud.aiplatform.models.Model
Runs the AutoML Image training job and returns a model.
If training on a Vertex AI dataset, you can use one of the following split
configurations:
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.
Data filter splits:
Assigns input data to training, validation, and test sets
based on the given filters, data pieces not matched by any
filter are ignored. Currently only supported for Datasets
containing DataItems.
If any of the filters in this message are to match nothing, then
they can be set as '-' (the minus sign).
If using filter splits, all of `training_filter_split`,
`validation_filter_split` and
`test_filter_split` must be provided.
Supported only for unstructured Datasets.
Parameters | |
---|---|
Name | Description |
dataset |
datasets.ImageDataset
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
Optional. 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
Optional. 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
Optional. The fraction of the input data that is to be used to evaluate the Model. This is ignored if Dataset is not provided. |
training_filter_split |
str
Optional. A filter on DataItems of the Dataset. DataItems that match this filter are used to train the Model. A filter with same syntax as the one used in DatasetService.ListDataItems may be used. If a single DataItem is matched by more than one of the FilterSplit filters, then it is assigned to the first set that applies to it in the training, validation, test order. This is ignored if Dataset is not provided. |
validation_filter_split |
str
Optional. A filter on DataItems of the Dataset. DataItems that match this filter are used to validate the Model. A filter with same syntax as the one used in DatasetService.ListDataItems may be used. If a single DataItem is matched by more than one of the FilterSplit filters, then it is assigned to the first set that applies to it in the training, validation, test order. This is ignored if Dataset is not provided. |
test_filter_split |
str
Optional. A filter on DataItems of the Dataset. DataItems that match this filter are used to test the Model. A filter with same syntax as the one used in DatasetService.ListDataItems may be used. If a single DataItem is matched by more than one of the FilterSplit filters, then it is assigned to the first set that applies to it in the training, validation, test order. This is ignored if Dataset is not provided. |
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. Defaults by |
model_display_name |
str
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. |
model_labels |
Dict[str, str]
Optional. The labels with user-defined metadata to organize your Models. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels. |
model_id |
str
Optional. The ID to use for the Model produced by this job, which will become the final component of the model resource name. This value may be up to 63 characters, and valid characters are |
parent_model |
str
Optional. The resource name or model ID of an existing model. The new model uploaded by this job will be a version of |
is_default_version |
bool
Optional. When set to True, the newly uploaded model version will automatically have alias "default" included. Subsequent uses of the model produced by this job without a version specified will use this "default" version. When set to False, the "default" alias will not be moved. Actions targeting the model version produced by this job will need to specifically reference this version by ID or alias. New model uploads, i.e. version 1, will always be "default" aliased. |
model_version_aliases |
Sequence[str]
Optional. User provided version aliases so that the model version uploaded by this job can be referenced via alias instead of auto-generated version ID. A default version alias will be created for the first version of the model. The format is |
model_version_description |
str
Optional. The description of the model version being uploaded by this job. |
disable_early_stopping |
bool
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. |
sync |
bool
bool = True 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. |
create_request_timeout |
float
Optional. The timeout for the create request in seconds. |
Exceptions | |
---|---|
Type | Description |
RuntimeError |
If Training job has already been run or is waiting to run. |
Returns | |
---|---|
Type | Description |
model |
The trained Vertex AI Model resource or None if training did not produce a Vertex AI Model. |
to_dict
to_dict() -> typing.Dict[str, typing.Any]
Returns the resource proto as a dictionary.
wait
wait()
Helper method that blocks until all futures are complete.
wait_for_resource_creation
wait_for_resource_creation() -> None
Waits until the resource has been created.