dmatrix / ray-core-serve-tutorial-mlops

A two part tutorial for Ray Core APIs and Ray Serve for Model Deployment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction to Model Deployment with Ray Serve

Welcome to the tutorial at MLOps World 2022 in Toronto!

This is a two-part introductory and ๐Ÿ‘ฉ hands-on ๐Ÿ’ป guided tutorial. Part one covers a ๐Ÿ‘ฉ hands-on ๐Ÿ’ป coding tour through the Ray core APIs, which provide powerful yet easy-to-use design patterns (tasks and actors) for implementing distributed systems in Python. Building on the foundation of Ray Core APIs, part two of this tutorial focuses on Ray Serve concepts, what and why Ray Serve, scalable architecture, and model deployment patterns.

Then, using code examples ๐Ÿ‘ฉโ€๐Ÿ’ป in Jupyter notebooks, we will take a coding tour of creating, exposing, and deploying models to Ray Serve using core deployment APIs.

And lastly, we will touch upon Ray Serveโ€™s integration with model registries such as MLflow, walk through an end-to-end example, and discuss and show Ray Serveโ€™s integration with FastAPI.

Key takeaways for students:

  • ๐Ÿ‘ฉโ€๐Ÿ’ป Code Ray Core APIs to convert Python function/classes into a distributed setting
  • ๐Ÿ“– Learn to use Ray Serve APIs to create, expose, and deploy models with Ray Server APIs
  • โ˜‘๏ธ Access and call deployment endpoints in Ray Serve via Python or HTTP
  • โš™๏ธ Configure compute resources and replicas to scale models in production
  • ๐Ÿ“– Learn about Ray Serve integrations with MLflow and FastAPI

Outline for the Tutorial Lessons ๐Ÿ“–

Notebooks Module 1 Ray Core API Patterns for Tasks, Objects, and Actors
00 Ray Tutorial Overview Overview of this tutorial.
01 Ray Remote Functions The Remote Function as Stateless Tasks Pattern.
02 Ray Remote Objects The Remote Objects as Futures Pattern.
03 Ray Remote Classes The Remote Classes as Stateful Actors Pattern
Module 2 Introduction to Ray Serve and model deployments
04 Ray Serve Model Serving Challenges What are model serving challenges
05 Ray Serve Model Composition Model composition model deployment pattern. A sentiment analysis model using HuggingFace ๐Ÿค— transformers
Extras Ray Serve Integration and end-to-end example
06 Ray Serve and MLflow Integration A simple model trained, logged to MLflow registry and served from in a Ray Serve deployment.
07 Ray Serve and FastAPI Integration A simple XGBoost model trained, deployed, and accesses via FastAPI endpoints
08 Ray Serve End to End Example An end-to-end example using XGBoost, Tune, and Ray Serve for classification model using diabetes dataset

๐Ÿง‘โ€๐ŸŽ“Prerequisite knowledge

Some prior experience with Python and Jupyter notebooks will be helpful, but we'll explain most details as we go if you haven't used notebooks before. Knowledge of basic machine learning concepts, including hyperparameters, model serving, and principles of distributed computing is helpful, but not required.

All exercises are optional and can be done on your laptop, preferably running a Linux or macOS, using all its cores. Because you wonโ€™t have access to Ray clusters, we have to run Ray locally and parallelize all your tasks on all your cores.

Python 3.7+ is required on your laptop, and some minimal installation of quick python packages using conda and pip.

๐Ÿ‘ฉโ€๐Ÿซ Instructions to get started

We assume that you have a conda installed.

  1. conda create -n ray-core-serve-tutorial python=3.8
  2. conda activate ray-core-serve-tutorial
  3. git clone git@github.com:dmatrix/ray-core-serve-tutorial-mlops.git
  4. cd to <cloned_dir>
  5. python3 -m pip install -r requirements.txt
  6. python3 -m ipykernel install
  7. conda install jupyterlab
  8. jupyter lab

If you are using Apple M1 laptop ๐ŸŽ run the following additional command:

  1. conda install grpcio

Let's have ๐Ÿ˜œ fun with Ray @ MLOps World 2022!

Thank you ๐Ÿ™,

Jules & Archit

About

A two part tutorial for Ray Core APIs and Ray Serve for Model Deployment

License:Apache License 2.0


Languages

Language:Jupyter Notebook 100.0%