aws / aws/sagemaker-python-sdk
`ModelBuilder.build()` fails when `image_uri` is a `ParameterString` (V2 -> V3 migration blocker)
- 主要语言
- Python
- 星标
- 2.3k
- 派生
- 1.3k
- 平均合并
- 1 天 22 小时
- 30 天内合并 PR
- 35
描述
**PySDK Version**
- [ ] PySDK V2 (2.x)
- [ x] PySDK V3 (3.x)
**Describe the bug**
When using `ModelBuilder` with a `ParameterString` for `image_uri` in a SageMaker pipeline, `model_builder.build()` raises a `TypeError`.
**To reproduce**
```
from sagemaker.core.workflow.parameters import ParameterString
from sagemaker.core.workflow.pipeline_context import PipelineSession
from sagemaker.serve.model_builder import ModelBuilder
model_builder = ModelBuilder(
image_uri=ParameterString(name="ServingImageUri"),
sagemaker_session=PipelineSession(),
)
model_builder.build()
```
```
TypeError: 'ParameterString' object is not subscriptable
File ".../sagemaker/serve/validations/check_image_uri.py", line 301, in is_1p_image_uri
image_uri_account = image_uri[0:12]
```
The `is_1p_image_uri()` function attempts to slice `image_uri` as a string, but `ParameterString` objects cannot be subscripted.
**Expected behavior**
`ModelBuilder` should fully support `ParameterString` parameters for pipeline execution.
**Additional context**
Related to #5524.
贡献指南
调研方向
使用 ModelBuilder、ParameterString 和 PipelineSession 重现 pipeline 案例,然后检查 sagemaker/serve/validations/check_image_uri.py 中 is_1p_image_uri() 附近的代码。确认 build() 接受 ParameterString image_uri 时不会出现 TypeError,并保留对普通字符串图像 URI 的支持。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- aws, python
- 领域
- machine-learning
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 72/100