aws / aws/sagemaker-python-sdk

`ModelBuilder.build()` fails when `image_uri` is a `ParameterString` (V2 -> V3 migration blocker)

オープン 初心者向け
#5,760 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
2.3k
フォーク
1.3k
平均マージ
1日 22時間
マージ済み PR(30日)
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() が TypeError なしで ParameterString image_uri を受け入れ、通常の文字列のイメージ URI も引き続きサポートすることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
aws, python
領域
machine-learning
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
72/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。