googleapis / googleapis/python-aiplatform

BatchPredictionJob.create does not support providing a value for instance_config

オープン
#3,031 コメント 3 件 リアクション 14 件 担当者 0 名 GitHub で見る
api: vertex-ai
主要言語
Python
スター
905
フォーク
465
平均マージ
1日 13時間
マージ済み PR(30日)
44

説明

**Is your feature request related to a problem? Please describe.**
We have a use case where we'd like to launch a Vertex AI Batch Prediction job using a custom model. In order for the Docker container backing our model to work, the inputs must be sent in as objects (i.e. `{"a": 1, "b": 2}` instead of `[1, 2]`). Currently, the only way to do this is to use the REST API and specify `"instanceConfig": {"instanceType": "object"}` as per [these docs](https://cloud.google.com/vertex-ai/docs/predictions/get-batch-predictions#filter_and_transform_input_data).

**Describe the solution you'd like**
We'd like to be able to set `instanceType` to `object` via the `BatchPredictionJob.create` method.

**Describe alternatives you've considered**
Using the REST API is, to my knowledge, the only alternative. We can use it, but it's not convenient - having this functionality available in the Python SDK would allow us to schedule Batch Prediction jobs in an easier manner. Moreover, it would be possible to update the official Airflow operator for this and we'd be able to leverage that instead of writing custom code.

Another alternative would be to export our data to GCS in JSONL format and use that as the input for our Batch Prediction job. However, that is also an additional step in our pipeline that we could avoid.

**Additional context**
I guess the easiest solution would be to extend the [`BatchPredictionJob.create` method](https://github.com/googleapis/python-aiplatform/blob/main/google/cloud/aiplatform/jobs.py#L384) to include a new optional field `instance_type: Optional[Literal["object", "array"]]` and attach the provided value (if any) to the `gapic_batch_prediction_job` object. Another approach would be to enable passing in the whole `instance_config` object. I'd be interested to hear which design sounds the most reasonable to you.

I'd be happy to submit a PR once a design is agreed upon.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。