Using Ray Serve to serve a model
In this section, we will use Ray Serve to serve two dummy models using the ensemble and pipeline patterns. We will use very basic models just to demonstrate the end-to-end process of using Ray Serve.
Using the ensemble pattern in Ray Serve
In this subsection, we will use Ray Serve to ensemble the results of two scikit-learn models:
- First of all, let’s create a deployment for deploying a RandomForestRegressor model using the following code snippet:
from ray import serve from sklearn.ensemble import RandomForestRegressor from sklearn.ensemble import AdaBoostRegressor from sklearn.datasets import make_regression @serve.deployment class RandomForestRegressorModel: def __init__(self): X, y = make_regression(n_features=4, n_informative=2, ...