Train and Publish Locally With RAPIDS and MLflow
RAPIDS is a suite of open source libraries for GPU-accelerated analytics.
RAPIDS cuML matches the scikit-learn API, so it can build on MLflow's existing support for scikit-learn-like models to support persistence and deployment."
The example workflows below train RAPIDs regression models to predict airline flight delays, using MLflow to log models and deploy them as local REST API endpoints for real-time inference. You can run them:
-
On a GPU-enabled instance for free in Colab. If following this approach, we recommend using the "Jupyter notebook workflow" below and following the setup steps in this Colab notebook to configure your environment.
-
On your own machine with an NVIDIA GPU and CUDA installed. See the RAPIDS getting-started guide for more details on necessary prerequisites for running the examples on your own machine.
Jupyter Notebook Workflow
CLI Based Workflow
-
Create data
cd examples/rapids/mlflow_project# Create iris.csv python -c "from sklearn.datasets import load_iris; d = load_iris(as_frame=True); d.frame.to_csv('iris.csv', index=False)"
-
Set MLflow tracking uri
-
export MLFLOW_TRACKING_URI=sqlite:////tmp/mlflow-db.sqlite
-
-
Train the model using a single run.
-
# Launch the job mlflow run . -e simple\ --experiment-name RAPIDS-CLI \ -P max_depth=10 -P max_features=0.75 -P n_estimators=500 \ -P conda-env=$PWD/envs/conda.yaml \ -P fpath=iris.csv
-
-
Train the model with Hyperopt
-
# Launch the job mlflow run . -e hyperopt \ --experiment-name RAPIDS-CLI \ -P conda-env=$PWD/envs/conda.yaml \ -P fpath=iris.csv - In the output, note: "Created version '[VERSION]' of model 'rapids_mlflow'"
-
-
Deploy your model
- Deploy your model
$ mlflow models serve --env-manager=local -m models:/rapids_mlflow_cli/[VERSION] -p 55755
- Deploy your model
-
Query the deployed model with test data
src/sample_server_query.shexample script.bash src/sample_server_query.sh