aws / aws/sagemaker-python-sdk

Create Awaitable predict capability

Ouverte
#3,973 10 commentaires 5 réactions 0 personnes assignées Voir sur GitHub
component: async inference type: feature request
Langage dominant
Python
Étoiles
2.3k
Forks
1.3k
Merge moyen
1 j 22 h
PR mergées (30 j)
35

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par le comportement documenté de Predictor.predict et comparez-le avec la fonctionnalité predictor_async existante liée dans l’issue, qui écrit les prédictions dans S3. Suivez la manière dont les appels aux endpoints SageMaker en temps réel sont effectués et déterminez l’interface nécessaire pour obtenir un équivalent awaitable. Le travail est terminé lorsque les applications Python asyncio peuvent utiliser await pour obtenir des prédictions en temps réel sans utiliser de comportement asynchrone reposant sur S3 ni bloquer la boucle d’événements.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
aws, python
Domaine
cloud, machine-learning
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.