aws / aws/sagemaker-python-sdk

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

Abierto
#4,774 1 comentario 0 reacciones 0 asignados Ver en GitHub
component: utility apis type: bug
Lenguaje dominante
Python
Estrellas
2.3k
Forks
1.3k
Merge medio
1 d 22 h
PR fusionados (30 d)
35

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en src/sagemaker/predictor_async.py, especialmente en AsyncPredictor.__init__ y _upload_data_to_s3 cerca de las líneas referenciadas. Reproduce el fallo con AsyncPredictor(Predictor(...)) y predict(data=...), y determina un valor predeterminado apropiado distinto de None para name. La tarea está completada cuando la ruta predeterminada documentada ya no provoca el TypeError indicado.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
aws, python
Área
machine-learning
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.