aws / aws/sagemaker-python-sdk
`ModelBuilder.build()` fails when `image_uri` is a `ParameterString` (V2 -> V3 migration blocker)
- Ngôn ngữ chính
- Python
- Star
- 2.3k
- Fork
- 1.3k
- Merge trung bình
- 1 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 35
Mô tả
**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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Tái hiện trường hợp pipeline bằng ModelBuilder, ParameterString và PipelineSession, sau đó kiểm tra sagemaker/serve/validations/check_image_uri.py quanh is_1p_image_uri(). Xác nhận rằng build() chấp nhận một ParameterString image_uri mà không gây ra TypeError và vẫn hỗ trợ các image URI dạng chuỗi thông thường.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- aws, python
- Lĩnh vực
- machine-learning
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 72/100