Debangshu Paul
Debangshu Paul

Reputation: 354

How to use tensorflow 2.0 with AWS Lambda?

I am new to AWS Lambda and running a tensorflow model in AWS Lambda. Now tensorflow 1.0.0 is the one that fits into the 50Mb limit but since tensorflow 2.0 is much bigger in size it does not fit. Does anyone knows of a way to use tensorflow 2.0 with AWS lambda?

Upvotes: 7

Views: 6224

Answers (5)

Wesley Cheek
Wesley Cheek

Reputation: 1726

I've been able to use Tensorflow on Lambda by deploying the function with a Docker image. See this post

Upvotes: 0

Rene B.
Rene B.

Reputation: 7424

There are serevarl options in order to deploy Tensorflow in AWS lambda:

  1. With Amazon EFS:

enter image description here

  1. Using AWS container images

enter image description here

  1. AWS Lambda using Serverless

  2. With AWS serverless and Tensorflow Lite

Upvotes: 0

Franco Piccolo
Franco Piccolo

Reputation: 7430

As of March 2021, the best solution is probably to use a container image for the Lambda as explained here.

Upvotes: 1

jhenya-d
jhenya-d

Reputation: 399

One of the variant is using EFS.
Run EC2 instance, mount EFS and install Tensorflow or any other library on it.
Then in lambda function you can select file system with installed libraries and import them in your function.
You can use AWS official documentation or try those tutorials.
For me it helps and i was able to import tensorflow in my lambda function.
How to use EFS (Elastic File System) with AWS Lambda: https://youtu.be/4cquiuAQBco
How to mount EFS on EC2 instance: https://youtu.be/PHVthx8lG4g
How to install library on EFS & import in lambda: https://youtu.be/FA153BGOV_A

Upvotes: 1

Arka Mukherjee
Arka Mukherjee

Reputation: 2320

AWS Lambda comes with an ephemeral storage unit in /tmp. However, please note that the ephemeral storage unit still has a storage of 512MB. You can load your dependencies to this storage, and write code accordingly.

Upvotes: 2

Related Questions