aws / aws/sagemaker-python-sdk

Create Awaitable predict capability

Đang mở
#3,973 10 bình luận 5 reaction 0 người được giao Xem trên GitHub
component: async inference type: feature request
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 feature you'd like**
Like many other inference libraries in python (e.g. OpenAI), create a real awaitable version of Predict for realtime sagemaker inference endpoints. This will help python applications that use FastAPI and asyncio to deliver realtime responses while not blocking the main event loop. Please note that this feature is different that the one currently available [here](https://sagemaker.readthedocs.io/en/v2.169.0/api/inference/predictor_async.html) where the predictions are written to a S3 bucket. This feature would work exactly like https://sagemaker.readthedocs.io/en/stable/api/inference/predictors.html#sagemaker.predictor.Predictor.predict but with an `await` in real `asyncio` style.

Sagemaker is an amazing library and it would be just way better for production environments using FastAPI to have this feature.

**How would this feature be used? Please describe.**
In this case, currently, the sync version looks like this:
```python
response = predictor.predict(input_data)
```
The async might be looking like
```python
response = await predictor.apredict(input_data)
```

**Describe alternatives you've considered**
I considered subclassing the `predictor` and add the async version.

**Additional context**
For modern python applications building on top of FastAPI and Asyncio, it is crucial to use async modalities do avoid blocking the main event-loop in the server (in case of scalable applications). Therefore, having a real `awaitable` functionality would avoid blocking the main event loop of the applications that leverage sagemaker.

Thanks alot

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

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

Hướng nghiên cứu

Bắt đầu với hành vi đã được ghi lại của Predictor.predict và so sánh với khả năng predictor_async hiện có được liên kết trong issue, vốn ghi các dự đoán vào S3. Truy vết cách các lệnh gọi đến các endpoint SageMaker thời gian thực được thực hiện và xác định interface cần thiết cho một phiên bản tương đương có thể await. Hoàn thành có nghĩa là các ứng dụng Python asyncio có thể await các dự đoán thời gian thực mà không sử dụng hành vi bất đồng bộ dựa trên S3 hoặc chặn event loop.

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
cloud, machine-learning
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
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.