googleapis / googleapis/python-aiplatform

Batch predict using custom models with mandatory parameter fields is not supported in vertex AI

未关闭
#2,666 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
api: vertex-ai
主要语言
Python
星标
905
派生
465
平均合并
1 天 13 小时
30 天内合并 PR
44

描述

We have custom models that requires passing mandatory parameter field for prediction.
Now this works for online predictions via endpoint in POST request,
but for batch predictions we have to create jsonl file .
The format of each line in jsonl is something like this

```
{"id1":1,"id2":1,"timestamp":"2023-09-28 09:55:47Z","key1":{some dict},"key2":{some dict}}
{...}
```
etc

This throws below error as parameter field is not present.

We tried adding it too but looks it doesn't work either. Can someone let us know to make it work as I see this as a bug.

#### Environment details

- OS type and version:
- Python version: `Python 3.9.1`
- pip version: `23.2.1`
- `google-cloud-aiplatform` version: `1.33.1`

#### Steps to reproduce

1. deploy a custom model with mandatory parameter in the request body for prediction
2. create batch input jsonl file in gcs bucket , use this file as input to batch predict method of the model.
3. Notice the job completion output error in the gcs bucket.

#### Code example

```python
job = model.batch_predict(machine_type="n1-standard-16", max_replica_count=3, job_display_name="test_score", gcs_source="gs://test/batch_predict_requests.jsonl", batch_size=1000, model_parameters=body["parameters"], gcs_destination_prefix="gs://test/output_dir", sync=True)
```

#### Stack trace
```
('Post request fails. Cannot get predictions. Error: Exceeded retries: Non-OK result 422 ({"detail":[{"loc":["body","parameters"],"msg":"field required","type":"value_error.missing"}]}) from server, retry=3, ellapsed=0.13s.', 1000)
```

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

贡献指南

打开贡献指南

调研方向

Start at the model.batch_predict entry point and trace how the gcs_source JSONL input and model_parameters are converted into batch prediction requests. Reproduce the job with the supplied custom model parameters and confirm that mandatory parameters reach the prediction request without the server's missing-field error.

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
cloud, machine-learning
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。