问题不言自明。
如果我有以下方式的 Kubeflow 管道:
# this is a kubeflow pipelines component dedicated to reformatting csv data to jsonl format
reformat_input_op = reformat_input_component(test_path)
# connect reformat prediction inputs op to batch prediction op
batch_prediction_request_jsonl_path = reformat_input_op.outputs['Batch Prediction Input GCS Path']
# batch prediction op
batch_prediction_op = gcc_aip.ModelBatchPredictOp(
project="<project id>",
job_display_name="Model Batch Prediction",
location="us-west1",
model=model_output,
gcs_source_uris=[batch_prediction_request_jsonl_path],
instances_format="jsonl",
gcs_destination_output_uri_prefix="gs://<bucket name>/<directory to file output>/",
machine_type="n1-standard-4",
accelerator_count=2,
accelerator_type="NVIDIA_TESLA_P100")
ModelBatchPredictOp
方法的参数,gcs_source_uris
无法获取输出字符串路径的前一个组件的输出(我得到一个TypeError: Object of type PipelineParam is not JSON serializable
错误)。
这很麻烦,因为我不想硬编码之前组件写入的 GCS bucket 的路径。我想要前一个组件输出的路径,在运行时输入到下一个组件。
对此有哪些解决方法?虽然这是这个 stackoverflow 查询的一个重复问题:Vertex AI Model Batch prediction, issue with referenceing existing model and input file on Cloud Storage
感觉好像问题没有在那里回答清楚。有没有办法将前一个组件的输入直接传递给
ModelBatchPredictOp()
对象?
注意:我不想回答说“在
.after()
上使用ModelBatchPredictOp()
方法”。我知道这是一个选项,我不明白为什么 Kubeflow Pipeline 组件 ModelBatchPredictOp()
不直接承认这个功能。有没有一种方法可以直接传递前一个组件的输出,而无需存储到其他 GCS 路径,然后在使用后调用它.after()
?