aws / aws/sagemaker-python-sdk

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

Đang mở
#4,774 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
component: utility apis type: bug
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ả

**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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu trong src/sagemaker/predictor_async.py, đặc biệt là AsyncPredictor.__init__ và _upload_data_to_s3 gần các dòng được tham chiếu. Tái hiện lỗi bằng AsyncPredictor(Predictor(...)) và predict(data=...), sau đó xác định một giá trị mặc định phù hợp khác None cho name. Hoàn tất khi đường dẫn mặc định được ghi trong tài liệu không còn gây ra TypeError đã báo cáo.

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
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.