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

Amazon SageMaker Studio运行XGBoost任务报S3路径正则校验错误

错误原因

你触发的校验错误完全由S3路径的格式错误导致:

  • 标准S3 URI的格式要求为s3://<bucket名称>/<路径前缀>,你在定义Estimator时,两处填写的路径都把s3://误写为s3//,缺少了冒号,不符合AWS要求的路径正则校验规则
  • 这处错误同时被outputDataConfig、debugHookConfig、profilerConfig三个配置项继承,所以触发了3条重复的校验报错
修复方案

直接替换Estimator定义中两处错误的s3//为s3://即可,修正后的对应代码如下:

xgb = Estimator(
    container,
    role=sagemaker.get_execution_role(),
    sagemaker_session=sess,
    input_mode='File',
    # 此处将s3//修正为s3://
    output_path='s3://{}/{}/output'.format(bucket, prefix),
    instance_count=1,
    instance_type='ml.m4.2xlarge',
    use_spot_instances=True,
    max_run=300,
    max_wait=600, # 额外提示:你原代码此处参数名写错了,max_weight应该为max_wait,否则后续会触发spot实例相关报错
    debugger_hook_config=DebuggerHookConfig(
        # 此处同样将s3//修正为s3://
        s3_output_path='s3://{}/{}/output'.format(bucket, prefix), 
        collection_configs=[
            CollectionConfig(name='metrics', parameters={'save_interval': str(save_interval)}),
            CollectionConfig(name='predictions', parameters={'save_interval': str(save_interval)})
        ]
    ),
    rules=[Rule.sagemaker(rule_configs.class_imbalance(), rule_parameters={'collection_names': 'metrics'})],
)

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.23 23:45:04