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

如何在SageMaker Pipeline处理步骤中正确使用参数?

解决SageMaker Pipeline参数传递到处理步骤的问题

你的问题核心是Pipeline中定义的参数没有传递到ProcessingStep的执行脚本里。虽然Pipeline层面声明了filename参数,但没有将其关联到ProcessingStep的命令行参数中,导致脚本无法接收到该值。

修复步骤:

在定义ProcessingStep时,添加arguments参数,将Pipeline的filename参数传递给处理脚本的命令行参数:

修改后的step_process代码:

step_process = ProcessingStep(
    name="ProcessStep",
    processor=my_processor,
    arguments=["--filename", filename]  # 新增此行,传递Pipeline参数给脚本
)

原理说明:

  • Pipeline的参数仅在Pipeline层面存在,需要显式通过arguments将其传递给具体的步骤。
  • arguments中的filename是你之前定义的ParameterString对象,SageMaker会在运行时将其解析为实际值,拼接成最终执行命令:python processing.py --filename 实际值。
  • 你的processing.py中使用argparse接收--filename参数的逻辑是正确的,修改后就能正常获取到参数值。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.30 18:06:39