aws / aws/aws-lambda-base-images

Timeout when importing torch

Open
#223 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
777
Forks
118
PR merge metrics
No merged PRs in 30d

Description

This example app.py always times out when `import torch` is included, but works without the import. The dockerfile works locally just fine. I have no explanation of the behavior. Whether I pip3 install torch or install from requirements.txt, the result is the same.

app.py
```
import json
import torch
import sys

def handler(event, context):
return 'Hello from AWS Lambda using Python' + sys.version + '!'
```

Dockerfile
```
FROM public.ecr.aws/lambda/python:3.7

RUN pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --target "${LAMBDA_TASK_ROOT}"

COPY app.py ${LAMBDA_TASK_ROOT}

CMD ["app.handler"]
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.