![](/img/trans.png)
[英]Return confidence score with custom model for Vertex AI batch predictions
[英]Vertex AI: Batch prediction for custom model fails with RuntimeError: BatchPredictionJob resource has not been created
我們正在嘗試為自定義 model 運行批量預測。
培訓是在本教程之后完成的: https://codelabs.developers.google.com/codelabs/vertex-ai-custom-code-training#4
在管道中提交作業的代碼:
model = aiplatform.Model(model_path)
batch_prediction_job = model.batch_predict(
gcs_source=gcs_source,
gcs_destination_prefix=gcs_destination,
machine_type='n1-standard-4',
instances_format='csv',
sync=False
)
運行批量預測作業失敗,管道中出現以下錯誤:
JobState.JOB_STATE_FAILED
[KFP Executor 2023-01-18 14:08:09,862 INFO]: BatchPredictionJob projects/472254905662/locations/us-central1/batchPredictionJobs/3522181183414730752 current state:
JobState.JOB_STATE_FAILED
Traceback (most recent call last):
File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.7/site-packages/kfp/v2/components/executor_main.py", line 104, in <module>
executor_main()
File "/usr/local/lib/python3.7/site-packages/kfp/v2/components/executor_main.py", line 100, in executor_main
executor.execute()
File "/usr/local/lib/python3.7/site-packages/kfp/v2/components/executor.py", line 309, in execute
result = self._func(**func_kwargs)
File "/tmp/tmp.ZqplJAZqqL/ephemeral_component.py", line 23, in create_batch_inference_component
print(f'Batch prediction job "{batch_prediction_job.resource_name}" submitted')
File "/usr/local/lib/python3.7/site-packages/google/cloud/aiplatform/base.py", line 676, in resource_name
self._assert_gca_resource_is_available()
File "/usr/local/lib/python3.7/site-packages/google/cloud/aiplatform/base.py", line 1324, in _assert_gca_resource_is_available
else ""
RuntimeError: BatchPredictionJob resource has not been created.
失敗的批量預測作業中存在錯誤,但無法理解其含義:
Batch prediction job BatchPredictionJob 2023-01-18 14:21:50.490123 encountered the following errors:
Model server terminated: model server container terminated: exit_code: 1 reason: "Error" started_at { seconds: 1674052639 } finished_at { seconds: 1674052640 }
針對同一泰坦尼克號數據集訓練的 AutoML model 的批量預測有效。
沒有辦法解決這個問題。 我們嘗試了不同的instance_format
,不指定machine_type
,改進了預測數據集(指南說所有字符串字段都應該用雙引號括起來)但這並沒有停止。
我們已經設法與我們的團隊解決了這個問題的兩個問題:
是的,我們的批量預測成功了,我們在 output 文件夾中得到了預測結果並且沒有錯誤。 但是 (.) 提交批量預測的管道仍然失敗,這真的很奇怪。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.