aws / aws/sagemaker-python-sdk
AsyncPredictor fails if name is None, despite it being the default
- 主要语言
- Python
- 星标
- 2.3k
- 派生
- 1.3k
- 平均合并
- 1 天 22 小时
- 30 天内合并 PR
- 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