Skip to content

Commit

Permalink
fix: Minor docstring and snippet fixes (#873)
Browse files Browse the repository at this point in the history
* docs: Update batch prediction job instance, predict format docstrings

* Update AutoML predict snippets to refer to correct YAML

Co-authored-by: Dan Lee <71398022+dandhlee@users.noreply.github.com>
  • Loading branch information
vinnysenthil and dandhlee committed Dec 7, 2021
1 parent e108ef8 commit 578e06d
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 27 deletions.
15 changes: 6 additions & 9 deletions .sample_configs/process_configs.yaml
Expand Up @@ -266,7 +266,7 @@ predict_image_classification_sample:
instance_dict: predict.instance.ImageClassificationPredictionInstance
parameters_dict: predict.params.ImageClassificationPredictionParams
comments:
predictions: See gs://google-cloud-aiplatform/schema/predict/prediction/classification.yaml
predictions: See gs://google-cloud-aiplatform/schema/predict/prediction/image_classification_1.0.0.yaml
for the format of the predictions.
predict_image_file_sample:
max_depth: 1
Expand All @@ -278,7 +278,7 @@ predict_image_object_detection_sample:
instance_dict: predict.instance.ImageObjectDetectionPredictionInstance
parameters_dict: predict.params.ImageObjectDetectionPredictionParams
comments:
predictions: See gs://google-cloud-aiplatform/schema/predict/prediction/image_object_detection.yaml
predictions: See gs://google-cloud-aiplatform/schema/predict/prediction/image_object_detection_1.0.0.yaml
for the format of the predictions.
predict_sample:
max_depth: 1
Expand All @@ -290,38 +290,35 @@ predict_tabular_classification_sample:
max_depth: 1
resource_name: endpoint
comments:
predictions: See gs://google-cloud-aiplatform/schema/predict/prediction/tables_classification.yaml
predictions: See gs://google-cloud-aiplatform/schema/predict/prediction/tabular_classification_1.0.0.yaml
for the format of the predictions.
predict_tabular_forecasting_sample: {}
predict_tabular_regression_sample:
max_depth: 1
resource_name: endpoint
comments:
predictions: See gs://google-cloud-aiplatform/schema/predict/prediction/tables_regression.yaml
predictions: See gs://google-cloud-aiplatform/schema/predict/prediction/tabular_regression_1.0.0.yaml
for the format of the predictions.
predict_text_classification_single_label_sample:
max_depth: 1
resource_name: endpoint
schema_types:
instance_dict: predict.instance.TextClassificationPredictionInstance
comments:
predictions: See gs://google-cloud-aiplatform/schema/predict/prediction/text_classification.yaml
for the format of the predictions.
predict_text_entity_extraction_sample:
max_depth: 1
resource_name: endpoint
schema_types:
instance_dict: predict.instance.TextExtractionPredictionInstance
comments:
predictions: See gs://google-cloud-aiplatform/schema/predict/prediction/text_extraction.yaml
predictions: See gs://google-cloud-aiplatform/schema/predict/prediction/text_extraction_1.0.0.yaml
for the format of the predictions.
predict_text_sentiment_analysis_sample:
max_depth: 1
resource_name: endpoint
schema_types:
instance_dict: predict.instance.TextSentimentPredictionInstance
comments:
predictions: See gs://google-cloud-aiplatform/schema/predict/prediction/text_sentiment.yaml
predictions: See gs://google-cloud-aiplatform/schema/predict/prediction/text_sentiment_1.0.0.yaml
for the format of the predictions.
search_migratable_resources_sample: {}
undeploy_model_sample:
Expand Down
13 changes: 7 additions & 6 deletions google/cloud/aiplatform/jobs.py
Expand Up @@ -380,13 +380,14 @@ def create(
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 `gcs_source`. If a
`bigquery_source` is provided, this is overridden to "bigquery".
Required. The format in which instances are provided. Must be one
of the formats listed in `Model.supported_input_storage_formats`.
Default is "jsonl" when using `gcs_source`. If a `bigquery_source`
is provided, this is overridden to "bigquery".
predictions_format (str):
Required. The format in which Vertex AI gives the
predictions, must be one of "jsonl", "csv", or "bigquery".
Required. The format in which Vertex AI outputs the
predictions, must be one of the formats specified in
`Model.supported_output_storage_formats`.
Default is "jsonl" when using `gcs_destination_prefix`. If a
`bigquery_destination_prefix` is provided, this is overridden to
"bigquery".
Expand Down
13 changes: 7 additions & 6 deletions google/cloud/aiplatform/models.py
Expand Up @@ -2099,10 +2099,10 @@ def batch_predict(
BigQuery URI to a table, up to 2000 characters long. For example:
`bq://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".
The format in which instances are provided. Must be one
of the formats listed in `Model.supported_input_storage_formats`.
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
Expand Down Expand Up @@ -2145,8 +2145,9 @@ def batch_predict(
```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".
Required. The format in which Vertex AI outputs the
predictions, must be one of the formats specified in
`Model.supported_output_storage_formats`.
Default is "jsonl" when using `gcs_destination_prefix`. If a
`bigquery_destination_prefix` is provided, this is overridden to
"bigquery".
Expand Down
Expand Up @@ -52,7 +52,7 @@ def predict_image_classification_sample(
)
print("response")
print(" deployed_model_id:", response.deployed_model_id)
# See gs://google-cloud-aiplatform/schema/predict/prediction/classification.yaml for the format of the predictions.
# See gs://google-cloud-aiplatform/schema/predict/prediction/image_classification_1.0.0.yaml for the format of the predictions.
predictions = response.predictions
for prediction in predictions:
print(" prediction:", dict(prediction))
Expand Down
Expand Up @@ -46,7 +46,7 @@ def predict_tabular_classification_sample(
)
print("response")
print(" deployed_model_id:", response.deployed_model_id)
# See gs://google-cloud-aiplatform/schema/predict/prediction/tables_classification.yaml for the format of the predictions.
# See gs://google-cloud-aiplatform/schema/predict/prediction/tabular_classification_1.0.0.yaml for the format of the predictions.
predictions = response.predictions
for prediction in predictions:
print(" prediction:", dict(prediction))
Expand Down
Expand Up @@ -46,7 +46,7 @@ def predict_tabular_regression_sample(
)
print("response")
print(" deployed_model_id:", response.deployed_model_id)
# See gs://google-cloud-aiplatform/schema/predict/prediction/tables_regression.yaml for the format of the predictions.
# See gs://google-cloud-aiplatform/schema/predict/prediction/tabular_regression_1.0.0.yaml for the format of the predictions.
predictions = response.predictions
for prediction in predictions:
print(" prediction:", dict(prediction))
Expand Down
Expand Up @@ -45,7 +45,7 @@ def predict_text_classification_single_label_sample(
)
print("response")
print(" deployed_model_id:", response.deployed_model_id)
# See gs://google-cloud-aiplatform/schema/predict/prediction/text_classification.yaml for the format of the predictions.

predictions = response.predictions
for prediction in predictions:
print(" prediction:", dict(prediction))
Expand Down
Expand Up @@ -46,7 +46,7 @@ def predict_text_entity_extraction_sample(
)
print("response")
print(" deployed_model_id:", response.deployed_model_id)
# See gs://google-cloud-aiplatform/schema/predict/prediction/text_extraction.yaml for the format of the predictions.
# See gs://google-cloud-aiplatform/schema/predict/prediction/text_extraction_1.0.0.yaml for the format of the predictions.
predictions = response.predictions
for prediction in predictions:
print(" prediction:", dict(prediction))
Expand Down
Expand Up @@ -45,7 +45,7 @@ def predict_text_sentiment_analysis_sample(
)
print("response")
print(" deployed_model_id:", response.deployed_model_id)
# See gs://google-cloud-aiplatform/schema/predict/prediction/text_sentiment.yaml for the format of the predictions.
# See gs://google-cloud-aiplatform/schema/predict/prediction/text_sentiment_1.0.0.yaml for the format of the predictions.
predictions = response.predictions
for prediction in predictions:
print(" prediction:", dict(prediction))
Expand Down

0 comments on commit 578e06d

Please sign in to comment.