aws / aws/sagemaker-python-sdk

Create Awaitable predict capability

Offen
#3,973 10 Kommentare 5 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
component: async inference type: feature request
Vorherrschende Sprache
Python
Sterne
2.3k
Forks
1.3k
Ø Merge
1 T. 22 Std.
Gemergte PRs (30 T.)
35

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit dem dokumentierten Verhalten von Predictor.predict und vergleiche es mit der im Issue verknüpften vorhandenen predictor_async-Funktionalität, die Vorhersagen in S3 schreibt. Verfolge, wie Aufrufe an Echtzeit-SageMaker-Endpunkte erfolgen, und ermittle die für ein awaitbares Äquivalent erforderliche Schnittstelle. Als erledigt gilt die Aufgabe, wenn Python-asyncio-Anwendungen Echtzeitvorhersagen awaiten können, ohne async-Verhalten auf Basis von S3 zu verwenden oder die Event-Schleife zu blockieren.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
aws, python
Bereich
cloud, machine-learning
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.