- 1.75.0 (latest)
- 1.74.0
- 1.73.0
- 1.72.0
- 1.71.1
- 1.70.0
- 1.69.0
- 1.68.0
- 1.67.1
- 1.66.0
- 1.65.0
- 1.63.0
- 1.62.0
- 1.60.0
- 1.59.0
- 1.58.0
- 1.57.0
- 1.56.0
- 1.55.0
- 1.54.1
- 1.53.0
- 1.52.0
- 1.51.0
- 1.50.0
- 1.49.0
- 1.48.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.39.0
- 1.38.1
- 1.37.0
- 1.36.4
- 1.35.0
- 1.34.0
- 1.33.1
- 1.32.0
- 1.31.1
- 1.30.1
- 1.29.0
- 1.28.1
- 1.27.1
- 1.26.1
- 1.25.0
- 1.24.1
- 1.23.0
- 1.22.1
- 1.21.0
- 1.20.0
- 1.19.1
- 1.18.3
- 1.17.1
- 1.16.1
- 1.15.1
- 1.14.0
- 1.13.1
- 1.12.1
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.1
- 1.7.1
- 1.6.2
- 1.5.0
- 1.4.3
- 1.3.0
- 1.2.0
- 1.1.1
- 1.0.1
- 0.9.0
- 0.8.0
- 0.7.1
- 0.6.0
- 0.5.1
- 0.4.0
- 0.3.1
CustomJob(
display_name: str,
worker_pool_specs: Union[
List[Dict], List[google.cloud.aiplatform_v1.types.custom_job.WorkerPoolSpec]
],
project: Optional[str] = None,
location: Optional[str] = None,
credentials: Optional[google.auth.credentials.Credentials] = None,
encryption_spec_key_name: Optional[str] = None,
staging_bucket: Optional[str] = None,
)
Vertex AI Custom Job.
Inheritance
builtins.object > google.cloud.aiplatform.base.VertexAiResourceNoun > builtins.object > google.cloud.aiplatform.base.FutureManager > google.cloud.aiplatform.base.VertexAiResourceNounWithFutureManager > google.cloud.aiplatform.jobs._Job > google.cloud.aiplatform.jobs._RunnableJob > CustomJobProperties
network
The full name of the Google Compute Engine network to which this CustomJob should be peered.
Takes the format projects/{project}/global/networks/{network}
. Where
{project} is a project number, as in 12345
, and {network} is a network name.
Private services access must already be configured for the network. If left unspecified, the CustomJob is not peered with any network.
Methods
CustomJob
CustomJob(
display_name: str,
worker_pool_specs: Union[
List[Dict], List[google.cloud.aiplatform_v1.types.custom_job.WorkerPoolSpec]
],
project: Optional[str] = None,
location: Optional[str] = None,
credentials: Optional[google.auth.credentials.Credentials] = None,
encryption_spec_key_name: Optional[str] = None,
staging_bucket: Optional[str] = None,
)
Cosntruct a Custom Job with Worker Pool Specs.
Example usage:
worker_pool_specs = [
{
"machine_spec": {
"machine_type": "n1-standard-4",
"accelerator_type": "NVIDIA_TESLA_K80",
"accelerator_count": 1,
},
"replica_count": 1,
"container_spec": {
"image_uri": container_image_uri,
"command": [],
"args": [],
},
}
]
my_job = aiplatform.CustomJob(
display_name='my_job',
worker_pool_specs=worker_pool_specs
)
my_job.run()
For more information on configuring worker pool specs please visit: https://cloud.google.com/ai-platform-unified/docs/training/create-custom-job
Name | Description |
display_name |
str
Required. The user-defined name of the HyperparameterTuningJob. The name can be up to 128 characters long and can be consist of any UTF-8 characters. |
worker_pool_specs |
Union[List[Dict], List[aiplatform.gapic.WorkerPoolSpec]]
Required. The spec of the worker pools including machine type and Docker image. Can provided as a list of dictionaries or list of WorkerPoolSpec proto messages. |
project |
str
Optional.Project to run the custom job in. Overrides project set in aiplatform.init. |
location |
str
Optional.Location to run the custom job in. Overrides location set in aiplatform.init. |
credentials |
auth_credentials.Credentials
Optional.Custom credentials to use to run call custom job service. Overrides credentials set in aiplatform.init. |
encryption_spec_key_name |
str
Optional.Customer-managed encryption key name for a CustomJob. If this is set, then all resources created by the CustomJob will be encrypted with the provided encryption key. |
staging_bucket |
str
Optional. Bucket for produced custom job artifacts. Overrides staging_bucket set in aiplatform.init. |
Type | Description |
RuntimeErro | is not staging bucket was set using aiplatfrom.init and a staging: |
bucke | was not passed in.: |
from_local_script
from_local_script(
display_name: str,
script_path: str,
container_uri: str,
args: Optional[List[Union[float, int, str]]] = None,
requirements: Optional[Sequence[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,
project: Optional[str] = None,
location: Optional[str] = None,
credentials: Optional[google.auth.credentials.Credentials] = None,
encryption_spec_key_name: Optional[str] = None,
staging_bucket: Optional[str] = None,
)
Configures a custom job from a local script.
Example usage:
job = aiplatform.CustomJob.from_local_script(
display_name="my-custom-job",
script_path="training_script.py",
container_uri="gcr.io/cloud-aiplatform/training/tf-cpu.2-2:latest",
requirements=["gcsfs==0.7.1"],
replica_count=1,
args=['--dataset', 'gs://my-bucket/my-dataset',
'--model_output_uri', 'gs://my-bucket/model']
)
job.run()
Name | Description |
display_name |
str
Required. The user-defined name of this CustomJob. |
script_path |
str
Required. Local path to training script. |
container_uri |
str
Required: Uri of the training container image to use for custom job. |
args |
Optional[List[Union[str, float, int]]]
Optional. Command line arguments to be passed to the Python task. |
requirements |
Sequence[str]
Optional. List of python packages dependencies of script. |
environment_variables |
Dict[str, str]
Optional. 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 |
int
Optional. 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 |
str
Optional. The type of machine to use for training. |
accelerator_type |
str
Optional. 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 |
int
Optional. The number of accelerators to attach to a worker replica. |
project |
str
Optional. Project to run the custom job in. Overrides project set in aiplatform.init. |
location |
str
Optional. Location to run the custom job in. Overrides location set in aiplatform.init. |
credentials |
auth_credentials.Credentials
Optional. Custom credentials to use to run call custom job service. Overrides credentials set in aiplatform.init. |
encryption_spec_key_name |
str
Optional. Customer-managed encryption key name for a CustomJob. If this is set, then all resources created by the CustomJob will be encrypted with the provided encryption key. |
staging_bucket |
str
Optional. Bucket for produced custom job artifacts. Overrides staging_bucket set in aiplatform.init. |
Type | Description |
RuntimeErro | is not staging bucket was set using aiplatfrom.init and a staging: |
bucke | was not passed in.: |
run
run(
service_account: Optional[str] = None,
network: Optional[str] = None,
timeout: Optional[int] = None,
restart_job_on_worker_restart: bool = False,
tensorboard: Optional[str] = None,
sync: bool = True,
)
Run this configured CustomJob.
Name | Description |
service_account |
str
Optional. Specifies the service account for workload run-as account. Users submitting jobs must have act-as permission on this run-as account. |
network |
str
Optional. 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. |
timeout |
int
The maximum job running time in seconds. The default is 7 days. |
restart_job_on_worker_restart |
bool
Restarts the entire CustomJob if a worker gets restarted. This feature can be used by distributed training jobs that are not resilient to workers leaving and joining a job. |
tensorboard |
str
Optional. The name of a Vertex AI Tensorboard resource to which this CustomJob will upload Tensorboard logs. Format: |
sync |
bool
Whether to execute this method synchronously. If False, this method will unblock and it will be executed in a concurrent Future. |