Serverless Deep Learning with AWS Lambda
Published by Pearson
Deploying a Classification Model with AWS Lambda and TensorFlow Lite
- Deploy Keras models with AWS Lambda and TensorFlow Lite.
- Train a deep learning model and host it in the cloud.
- Learn to deploy your own deep learning model in production on AWS
Deep learning achieves the best performance for computer vision, natural language processing, and recommendation tasks. However, it’s difficult to use deep learning in production since it requires a lot of effort to develop proper infrastructure for serving deep learning models. Platforms for serverless computing, such as AWS Lambda, provide a good alternative as they take care of scaling up and down, and offer attractive pricing based only on actual usage. In this workshop, you'll learn how to deploy Keras models with AWS Lambda and TensorFlow Lite. You will be able to train a similar model and host it in the cloud. After finishing, you’ll be able to use AWS to deploy a model yourself.
What you’ll learn and how you can apply it
By the end of the live online course, you’ll understand:
- What is Serverless and AWS Lambda and how to use them for executing custom Python code
- What is TensorFlow Lite and how to use it for Keras and TensorFlow models
- What is API Gateway and how to turn AWS Lambda functions into a web service
And you’ll be able to:
- Convert a Keras model to TensorFlow Lite format
- Use TensorFlow Lite for making predictions
- Package the dependencies of our services with Docker
- Deploy Docker images containing TensorFlow Lite models with AWS Lambda
This live event is for you because...
- You’re a data scientist or a software engineer interested in machine learning
- You want to learn more about deploying deep learning models using serverless technologies
Prerequisites
- You should be comfortable following code in Python.
- Basic knowledge of Python is required (for loops, data structures like lists and dictionaries, imports).
- Experience with Python tools and libraries like Jupyter and NumPy
- Prior exposure to Docker is recommended
- Prior exposure to AWS or other cloud providers is recommended as well
- Experience with Machine Learning will be helpful, but not required Course Set-up
- You can just watch the live coding session. To reproduce it, you will need: Jupyter Notebook. The simplest way to get it is to install Anaconda.
- TensorFlow. Alexey will show how to install it.
- Docker and AWS. Alexey will not show how to install Docker or register on AWS, but he will give links.
- The code used in this course is available on https://github.com/alexeygrigorev/deep-learning-keras-aws-lambda
Recommended Preparation
- Attend: Image Classification with TensorFlow and Keras by Alexey Grigorev
- Watch: End-to End Machine Learning: From Training a Model to Deploying to the Cloud (Video) by Alexey Grigorev
Recommended Follow-up
- Read: Machine Learning Bootcamp by Alexey Grigorev
Schedule
The time frames are only estimates and may vary according to how the class is progressing.
Segment 1: Introduction (10 minutes)
- About the instructor
- What we’ll cover today
- Setting up the environment — AWS, Anaconda + Jupyter, Docker, VS Code
- Quick recap of the training module
Segment 2: AWS Lambda (30 minutes)
- What is AWS Lambda
- Implementing a simple Lambda function
- Lambda and Docker
Break: 5 minutes Q&A: 10 minutes
Segment 3: TensorFlow Lite (40 minutes)
- TensorFlow vs TensorFlow Lite
- Converting Keras models to TF Lite
- Making predictions with TF Lite
- Using keras-image-helper for pre-processing of images
Break: 5 minutes Q&A: 10 minutes
Segment 4: AWS Lambda + TF Lite (40 minutes)
- Putting everything together
- Preparing a Docker file
- Using a pre-compiled version of TF Lite for AWS Lambda
- Testing Lambda code locally
- Uploading the docker image to ECR
- Creating and testing a Lambda function
Segment 5: API Gateway (10 minutes)
- Putting the Lambda function in a web service
- Using the webservice for image classification
Q&A: 10 minutes
Wrapping up, next steps: 10 minutes
Your Instructor
Alexey Grigorev
Alexey Grigorev works as a principal data scientist at OLX. He runs DataTalks.Club — a community for data enthusiasts. Alexey has written books about machine learning including his most recent, Machine Learning Bookcamp, which is a book for software engineers who want to get into machine learning. He lives in Berlin with his wife and son.