Code Monkey home page Code Monkey logo

aws-lambda-docker-serverless-inference's Introduction

Pay as you go inference with AWS Lambda (Container Image Support)

AWS ML AWS Lambda Docker

This repository contains resources to help you deploy Lambda Functions based on Python and Java Docker Images.

The applications deployed illustrate how to perform inference for scikit-learn, XGBoost, TensorFlow and PyTorch models using Lambda Function.

Overview

AWS Lambda is one of the most cost-effective service that lets you run code without provisioning or managing servers.

It offers many advantages when working with serverless infrastructure. When you break down the logic of your machine learning service into a single Lambda function for a single request, things become much simpler and easy to scale.

You can forget all about the resource handling needed for the parallel requests coming into your model.

If your usage is sparse and tolerable to a higher latency, Lambda is a great choice among various solutions.

Repository Structure

The repository contains the following resources:

Installation Instructions

  1. Create an AWS account if you do not already have one and login.

  2. Install Docker Desktop

  3. Install the AWS CLI and Configure AWS credentials.

  4. Clone the repo onto your local development machine using git clone.

  5. Open the project in any IDE of your choice in order to run the example Python and Java files.

  6. Follow the instructions in each of the example README.md file.

Questions?

Please contact @e_sela or raise an issue on this repo.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

aws-lambda-docker-serverless-inference's People

Contributors

amazon-auto avatar bauer-jan avatar dependabot[bot] avatar eitansela avatar pandapover avatar shneydor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-lambda-docker-serverless-inference's Issues

sam build files on xgboost-inference-arm64-docker-lambda

clean build fails as shown below -- basically blocks ability to develop/deploy arm64/graviton functions

Status: Downloaded newer image for public.ecr.aws/lambda/python:3.8-arm64 ---> f7892dec0f19
Step 2/7 : COPY requirements.txt ./
 ---> f326d820d212
Step 3/7 : RUN python3.8 -m pip install -r requirements.txt -t .
 ---> [Warning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64/v3) and no specific platform was requested
 ---> Running in 18c403fbd949
exec /bin/sh: exec format error

Build Failed
Error: XGBoostInferenceArm64Function failed to build: The command '/bin/sh -c python3.8 -m pip install -r requirements.txt -t .' returned a non-zero code: 1

system info:

$ uname -a
Linux ### 5.19.0-42-generic #43~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Apr 21 16:51:08 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

The cleanup command provided in the README doesn't work

According to the README, the following command will clean up the project after deploying it:
aws cloudformation delete-stack --stack-name tensorflow-inference-docker-lambda

When I run this, the stacks fail to be deleted because they include non-empty S3 buckets. In order to delete the stacks, I have to delete the contents of the buckets and then the buckets themselves.

It would be great to update the README with correct instructions for removing the project from AWS.

pytorch-inference-docker-lambda return AssertionError using GPU

Hi,

When I play around with the pytorch-inference-docker-lambda example, it can smoothly run in the Pytorch CPU version. But I try to add .to('cuda') to the model and received the image. I received the following error message.

{"errorMessage": "\nFound no NVIDIA driver on your system. Please check that you\nhave an NVIDIA GPU and installed a driver from\nhttp://www.nvidia.com/Download/index.aspx", "errorType": "AssertionError", "stackTrace": [" File \"/var/task/app.py\", line 25, in handler\n torch_image = scaled_img.unsqueeze(0).to('cuda')\n", " File \"/var/lang/lib/python3.8/site-packages/torch/cuda/__init__.py\", line 196, in _lazy_init\n _check_driver()\n", " File \"/var/lang/lib/python3.8/site-packages/torch/cuda/__init__.py\", line 98, in _check_driver\n raise AssertionError(\"\"\"\n"]}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.