- 1.73.0 (latest)
- 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
BatchPredictionJob(
batch_prediction_job_name: str,
project: Optional[str] = None,
location: Optional[str] = None,
credentials: Optional[google.auth.credentials.Credentials] = None,
)
Retrieves a BatchPredictionJob resource and instantiates its representation.
Parameter
Name | Description |
batch_prediction_job_name |
str
Required. A fully-qualified BatchPredictionJob resource name or ID. Example: "projects/.../locations/.../batchPredictionJobs/456" or "456" when project and location are initialized or passed. |
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 > BatchPredictionJobProperties
completion_stats
Statistics on completed and failed prediction instances.
output_info
Information describing the output of this job, including output location into which prediction output is written.
This is only available for batch predicition jobs that have run successfully.
partial_failures
Partial failures encountered. For example, single files that can't be read. This field never exceeds 20 entries. Status details fields contain standard GCP error details.
Methods
create
create(
job_display_name: str,
model_name: Union[str, google.cloud.aiplatform.models.Model],
instances_format: str = "jsonl",
predictions_format: str = "jsonl",
gcs_source: Optional[Union[str, Sequence[str]]] = None,
bigquery_source: Optional[str] = None,
gcs_destination_prefix: Optional[str] = None,
bigquery_destination_prefix: Optional[str] = None,
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_v1.types.explanation_metadata.ExplanationMetadata
] = None,
explanation_parameters: Optional[
google.cloud.aiplatform_v1.types.explanation.ExplanationParameters
] = None,
labels: Optional[Dict[str, str]] = None,
project: Optional[str] = None,
location: Optional[str] = None,
credentials: Optional[google.auth.credentials.Credentials] = None,
encryption_spec_key_name: Optional[str] = None,
sync: bool = True,
)
Create a batch prediction job.
Name | Description |
job_display_name |
str
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. |
model_name |
Union[str, aiplatform.Model]
Required. A fully-qualified model resource name or model ID. Example: "projects/123/locations/us-central1/models/456" or "456" when project and location are initialized or passed. Or an instance of aiplatform.Model. |
instances_format |
str
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 |
predictions_format |
str
Required. The format in which Vertex AI gives the predictions, must be one of "jsonl", "csv", or "bigquery". Default is "jsonl" when using |
gcs_source |
Optional[Sequence[str]]
Google Cloud Storage URI(-s) to your instances to run batch prediction on. They must match |
bigquery_source |
Optional[str]
BigQuery URI to a table, up to 2000 characters long. For example: |
gcs_destination_prefix |
Optional[str]
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
|
bigquery_destination_prefix |
Optional[str]
The BigQuery project location where the output is to be written to. In the given project a new dataset is created with name
|
model_parameters |
Optional[Dict]
The parameters that govern the predictions. The schema of the parameters may be specified via the Model's |
machine_type |
Optional[str]
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]
The type of accelerator(s) that may be attached to the machine as per |
accelerator_count |
Optional[int]
The number of accelerators to attach to the |
starting_replica_count |
Optional[int]
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 |
Optional[int]
The maximum number of machine replicas the batch operation may be scaled to. Only used if |
generate_explanation |
bool
Optional. Generate explanation along with the batch prediction results. This will cause the batch prediction output to include explanations based on the |
explanation_metadata |
aiplatform.explain.ExplanationMetadata
Optional. Explanation metadata configuration for this BatchPredictionJob. Can be specified only if |
explanation_parameters |
aiplatform.explain.ExplanationParameters
Optional. Parameters to configure explaining for Model's predictions. Can be specified only if |
labels |
Dict[str, str]
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. |
credentials |
Optional[auth_credentials.Credentials]
Custom credentials to use to create this batch prediction job. Overrides credentials set in aiplatform.init. |
encryption_spec_key_name |
Optional[str]
Optional. The Cloud KMS resource identifier of the customer managed encryption key used to protect the job. Has the form: |
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. |
Type | Description |
(jobs.BatchPredictionJob) | Instantiated representation of the created batch prediction job. |
iter_outputs
iter_outputs(bq_max_results: Optional[int] = 100)
Returns an Iterable object to traverse the output files, either a list of GCS Blobs or a BigQuery RowIterator depending on the output config set when the BatchPredictionJob was created.
Type | Description |
RuntimeError | If BatchPredictionJob is in a JobState other than SUCCEEDED, since outputs cannot be retrieved until the Job has finished. |
NotImplementedError | If BatchPredictionJob succeeded and output_info does not have a GCS or BQ output provided. |
Type | Description |
Union[Iterable[storage.Blob], Iterable[bigquery.table.RowIterator]] | Either a list of GCS Blob objects within the prediction output directory or an iterable BigQuery RowIterator with predictions. |
wait_for_resource_creation
wait_for_resource_creation()
Waits until resource has been created.