https://github.com/robmarkcole/aws-lambda-pytorch-image-classification-example
Example of implementing a pytorch image classifier service using AWS lambda
https://github.com/robmarkcole/aws-lambda-pytorch-image-classification-example
Last synced: 10 months ago
JSON representation
Example of implementing a pytorch image classifier service using AWS lambda
- Host: GitHub
- URL: https://github.com/robmarkcole/aws-lambda-pytorch-image-classification-example
- Owner: robmarkcole
- License: apache-2.0
- Created: 2021-07-12T06:27:59.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-06-23T13:03:26.000Z (almost 4 years ago)
- Last Synced: 2025-08-28T01:13:39.321Z (10 months ago)
- Language: Python
- Size: 12.2 MB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# aws-lambda-pytorch-image-classification-example
Example of implementing a pytorch image classifier service using AWS lambda. Cold start time can be 10-20 seconds. Subsequent inferences happen in approx 300-500 ms.
```
docker build -t lambda-pytorch-example .
docker run -p 9000:8080 \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
aws-lambda-pytorch-image-classification-example:latest
```
To connect to the shell of the running container, check the container name with `docker container ls` then `docker exec -it /bin/bash`. Run the `request.py` file to make a request.
## CICD
A github action is used to push the latest release to ECR, enter required credentials in repo secrets
## References
* https://github.com/gokavak/lambda-docker-image-pytorch-xgboost
* https://github.com/aws-samples/aws-lambda-docker-serverless-inference/tree/main/pytorch-inference-docker-lambda