Class AutoMLImageTrainingJob (1.15.1)

AutoMLImageTrainingJob(
    display_name: Optional[str] = None,
    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,
    credentials: Optional[google.auth.credentials.Credentials] = None,
    labels: Optional[Dict[str, str]] = None,
    training_encryption_spec_key_name: Optional[str] = None,
    model_encryption_spec_key_name: Optional[str] = None,
)

Constructs a AutoML Image Training Job.

Parameters

NameDescription
display_name str

Optional. The user-defined name of this TrainingPipeline.

prediction_type str

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.

project str

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

location str

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

credentials auth_credentials.Credentials

Optional. Custom credentials to use to run call training service. Overrides credentials set in aiplatform.init.

labels Dict[str, str]

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

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. 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[str]

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.

Inheritance

builtins.object > google.cloud.aiplatform.base.VertexAiResourceNoun > builtins.object > google.cloud.aiplatform.base.FutureManager > google.cloud.aiplatform.base.VertexAiResourceNounWithFutureManager > builtins.object > abc.ABC > google.cloud.aiplatform.base.DoneMixin > google.cloud.aiplatform.base.StatefulResource > google.cloud.aiplatform.base.VertexAiStatefulResource > google.cloud.aiplatform.training_jobs._TrainingJob > AutoMLImageTrainingJob

Methods

run

run(
    dataset: google.cloud.aiplatform.datasets.image_dataset.ImageDataset,
    training_fraction_split: Optional[float] = None,
    validation_fraction_split: Optional[float] = None,
    test_fraction_split: Optional[float] = None,
    training_filter_split: Optional[str] = None,
    validation_filter_split: Optional[str] = None,
    test_filter_split: Optional[str] = None,
    budget_milli_node_hours: Optional[int] = None,
    model_display_name: Optional[str] = None,
    model_labels: Optional[Dict[str, str]] = None,
    model_id: Optional[str] = None,
    parent_model: Optional[str] = None,
    is_default_version: Optional[bool] = True,
    model_version_aliases: Optional[Sequence[str]] = None,
    model_version_description: Optional[str] = None,
    disable_early_stopping: bool = False,
    sync: bool = True,
    create_request_timeout: Optional[float] = None,
)

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
NameDescription
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 prediction_type: classification - For Cloud models the budget must be: 8,000 - 800,000 milli node hours (inclusive). The default value is 192,000 which represents one day in wall time, assuming 8 nodes are used. object_detection - For Cloud models the budget must be: 20,000 - 900,000 milli node hours (inclusive). The default value is 216,000 which represents one day in wall time, assuming 9 nodes are used. 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.

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 [a-z0-9_-]. The first character cannot be a number or hyphen.

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 parent_model. Only set this field when training a new version of an existing model.

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 a-z][a-zA-Z0-9-]{0,126}[a-z0-9]

model_version_description str

Optional. The description of the model version being uploaded by this job.

create_request_timeout float

Optional. The timeout for the create request in seconds.

Exceptions
TypeDescription
RuntimeErrorIf Training job has already been run or is waiting to run.
Returns
TypeDescription
modelThe trained Vertex AI Model resource or None if training did not produce a Vertex AI Model.