【问题标题】:When running custom container in Kubeflow, how to pass arguments to the container?在 Kubeflow 中运行自定义容器时,如何将参数传递给容器?
【发布时间】:2021-11-11 23:05:49
【问题描述】:

我创建了一个容器映像,并希望将其作为我的 Kubeflow 管道的一部分运行。

我在本地测试了镜像,运行没问题:

docker run $IMAGE_URI --my_argument 28

我尝试使用预构建的组件 [CustomContainerTrainingJobRunOp][1] 在 Kubeflow 中运行它,但失败了。似乎问题出在参数上,因为在 Python 代码中硬编码参数值时没有问题。如何正确传递此组件中的参数?谢谢。

import kfp
from kfp.v2 import compiler
from kfp.v2.dsl import component
from kfp.v2.google import experimental
from kfp.v2.google.client import AIPlatformClient
from google_cloud_pipeline_components import aiplatform as gcc_aip

@kfp.dsl.pipeline(name=pipeline_name, pipeline_root='gs://a-gcs-bucket')
def pipeline():
    
    subclass_training_job_run_op = gcc_aip.CustomContainerTrainingJobRunOp(
        project=project_id, 
        display_name=model_display_name,
        container_uri=subclass_container_uri,
        args=["--my_argument", 28],
        staging_bucket=staging_bucket,
        base_output_dir=base_output_uri,
        #dataset=dataset_create_op.outputs["dataset"]
    )

Thank you!


  [1]: https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-0.1.4/google_cloud_pipeline_components.aiplatform.html#google_cloud_pipeline_components.aiplatform.CustomContainerTrainingJobRunOp

【问题讨论】:

    标签: containers kubeflow google-cloud-vertex-ai


    【解决方案1】:

    问题解决了:

    args=["--my_argument", "28"]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-02
      • 2018-02-06
      • 2019-06-12
      • 2019-12-28
      • 2022-11-04
      • 2011-06-17
      相关资源
      最近更新 更多