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
相关产品推荐
相关产品推荐

