aws / aws/sagemaker-python-sdk

AsyncPredictor fails if name is None, despite it being the default

オープン
#4,774 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
component: utility apis type: bug
主要言語
Python
スター
2.3k
フォーク
1.3k
平均マージ
1日 22時間
マージ済み PR(30日)
35

説明

**Describe the bug**

The `name` argument of the `AsyncPredictor.__init__.py` is optional with default=None

https://github.com/aws/sagemaker-python-sdk/blob/b535ed87ae55fd1020ea1d7c7c9cd7e3a068a683/src/sagemaker/predictor_async.py#L34

But calling `async_predictor.predict(data=...)` requires name to be non-null, i.e.` _upload_data_to_s3 ` calls `name_from_base` on `self.name` which fails if name is None (i.e. the default)

https://github.com/aws/sagemaker-python-sdk/blob/b535ed87ae55fd1020ea1d7c7c9cd7e3a068a683/src/sagemaker/predictor_async.py#L171

**To reproduce**

```
from sagemaker.predictor import Predictor
from sagemaker.predictor_async import AsyncPredictor

predictor = Predictor(endpoint_name=endpoint_name, sagemaker_session=sagemaker_session)
async_predictor = AsyncPredictor(predictor)

result = async_predictor.predict(data=request_body)
```
TypeError: 'NoneType' object is not subscriptable

**Expected behavior**
The name field of `AsyncPredictor` should have a "non-None" default (a guid, or the endpoint name?)

**System information**
A description of your system. Please provide:
- **SageMaker Python SDK version**: '2.224.2'
- **Framework name (eg. PyTorch) or algorithm (eg. KMeans)**: PyTorch / Triton (custom inference container)
- **Framework version**:
- **Python version**:
- **CPU or GPU**:
- **Custom Docker image (Y/N)**: Y

**Additional context**
Add any other context about the problem here.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

src/sagemaker/predictor_async.py から始め、特に参照されている行付近の AsyncPredictor.__init__ と _upload_data_to_s3 を確認します。AsyncPredictor(Predictor(...)) と predict(data=...) を使って失敗を再現し、name に適切な None 以外のデフォルト値を決定します。ドキュメント化されたデフォルトパスで報告された TypeError が発生しなくなれば完了です。

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

評価

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

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

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