aws / aws/sagemaker-python-sdk

Respect default_bucket_prefix by default for Estimator code_location

已关闭
#5,208 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
component: training type: feature request
主要语言
Python
星标
2.3k
派生
1.3k
平均合并
1 天 22 小时
30 天内合并 PR
35

描述

**Describe the feature you'd like**
Currently the `code_location` attribute of the Estimator class defaults to using the `output_bucket` parameter [docs link](https://sagemaker.readthedocs.io/en/stable/api/training/estimators.html#sagemaker.estimator.EstimatorBase):

> If not specified, the default code location is ‘s3://output_bucket/job-name/’.

The [Session object also has a parameter](https://sagemaker.readthedocs.io/en/stable/api/utility/session.html#sagemaker.session.Session) `default_bucket_prefix` that can be configured.

Ideally, if
1. The `output_bucket` part of `output_path` is the `default_bucket`
2. `_is_output_path_set_from_default_bucket_and_prefix` is False

Then the default location should respect both the `default_bucket` as well as the `default_bucket_prefix`.

e.g. `s3://default_bucket/default_bucket_prefix/job-name/`

This change would be implemented in [_stage_user_code_in_s3](https://github.com/aws/sagemaker-python-sdk/blob/23109671f6262269ab54cdd9aeb5ebe4ea640d25/src/sagemaker/estimator.py#L1042).

Otherwise, the default behavior creates artifacts at the root of the bucket. This means that default behavior for environments where IAM bucket write access is limited by prefix (i.e. SageMaker Unified Studio) will fail.

**How would this feature be used? Please describe.**
If this behavior is implemented, model code assets would be uploaded by default to a prefix where write access is allowed.

**Describe alternatives you've considered**
Currently `code_location` needs to be manually configured to work in SageMaker Unified Studio. This is poorly documented as part of features like [ModelStep](https://sagemaker.readthedocs.io/en/stable/workflows/pipelines/sagemaker.workflow.pipelines.html#sagemaker.workflow.model_step.ModelStep) where it needs to be configured in `repack_model_step_settings` as the model.register output populates `output_path` by default in a pipeline.

If this change cannot be implemented in code, explicit documentation should be provided about configuring parameters to output code in the SageMaker Unified Studio project prefix.

贡献指南

打开贡献指南

调研方向

从 src/sagemaker/estimator.py 中的 _stage_user_code_in_s3 开始,然后查看链接的 Estimator 和 Session 文档,以及 ModelStep/repack_model_step_settings 的相关引用。在所述输出路径条件下,默认代码位置使用 default_bucket_prefix;如果无法修改代码,则文档涵盖配置方式,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
aws, python
领域
cloud, machine-learning
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。