You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

配置Vertex AI Pipeline的NVIDIA_L4 GPU时参数报错,如何解决?

解决Vertex AI Pipeline配置NVIDIA_L4 GPU时的TypeError错误

错误原因

你调用add_node_selector_constraint()时传入了两个位置参数,但当前使用的SDK版本中,该方法仅接受一个位置参数(方法自身的self参数除外),因此触发参数数量不匹配的错误。

解决方案

方案1:升级SDK到最新版本

将KFP(Kubeflow Pipelines)和Google Cloud AI Platform SDK升级至最新稳定版,升级后原代码的调用方式即可正常工作:

@pipeline(name = 'llm-pipeline')
def data_pipeline():
    answer = answer_prompt()
    answer.add_node_selector_constraint('cloud.google.com/gke-accelerator', 'NVIDIA_L4')

方案2:传递字典格式参数(无需升级SDK)

如果无法升级SDK,将加速器的键值对封装为字典传入方法:

@pipeline(name = 'llm-pipeline')
def data_pipeline():
    answer = answer_prompt()
    answer.add_node_selector_constraint({'cloud.google.com/gke-accelerator': 'NVIDIA_L4'})

补充:指定GPU数量

若需要明确GPU使用数量,可配合set_gpu_limit()方法:

@pipeline(name = 'llm-pipeline')
def data_pipeline():
    answer = answer_prompt()
    answer.set_gpu_limit(1)  # 指定1块GPU
    # 根据SDK版本选择上述任一add_node_selector_constraint调用方式

内容的提问来源于stack exchange,提问作者Neil Bhutada

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 10:16:16