Ray Serve MLflow deployment plugin
Project description
MLflow-Ray-Serve
An experimental plugin that integrates Ray Serve with the MLflow pipeline.
mlflow-ray-serve
enables MLflow users to deploy MLflow models at scale on Ray Serve.
This plugin implements the Python API and command-line interface for MLflow deployment plugins.
Installation
pip install mlflow-ray-serve
The following packages are required and will be installed along with the plugin:
"ray[serve]"
"mlflow>=1.12.0"
This plugin requires Ray version 1.7.0 or greater.
Usage
This plugin must be used with a detached Ray Serve instance running on a Ray cluster. An easy way to set this up is by running the following two commands:
ray start --head # Start a single-node Ray cluster locally.
serve start # Start a detached Ray Serve instance.
The API is summarized below. For full details see the MLflow deployment plugin Python API and command-line interface documentation.
Create deployment
Deploy a model built with MLflow using Ray Serve with the desired configuration parameters; for example, num_replicas
. Currently this plugin only supports the python_function
flavor of MLflow models, and this is the default flavor.
CLI
mlflow deployments create -t ray-serve -m <model uri> --name <deployment name> -C num_replicas=<number of replicas>
Python API
from mlflow.deployments import get_deploy_client
target_uri = 'ray-serve'
plugin = get_deploy_client(target_uri)
plugin.create_deployment(
name=<deployment name>,
model_uri=<model uri>,
config={"num_replicas": 4})
Update deployment
Modify the configuration of a deployed model and/or replace the deployment with a new model URI.
CLI
mlflow deployments update -t ray-serve --name <deployment name> -C num_replicas=<new number of replicas>
Python API
plugin.update_deployment(name=<deployment name>, config={"num_replicas": <new number of replicas>})
Delete deployment
Delete an existing deployment.
CLI
mlflow deployments delete -t ray-serve --name <deployment name>
Python API
plugin.delete_deployment(name=<deployment name>)
List deployments
List the names of all the models deployed on Ray Serve. Includes models not deployed via this plugin.
CLI
mlflow deployments list -t ray-serve
Python API
plugin.list_deployments()
Get deployment details
CLI
mlflow deployments get -t ray-serve --name <deployment name>
Python API
plugin.get_deployment(name=<deployment name>)
Run prediction on deployed model
For the prediction inputs, DataFrame, Tensor and JSON formats are supported by the Python API. To invoke via the command line, pass in the path to a JSON file containing the input.
CLI
mlflow deployments predict -t ray-serve --name <deployment name> --input-path <input file path> --output-path <output file path>
output-path
is an optional parameter. Without it, the result will be printed in the terminal.
Python API
plugin.predict(name=<deployment name>, df=<prediction input>)
Plugin help
Prints the plugin help string.
CLI
mlflow deployments help -t ray-serve
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mlflow-ray-serve-0.2.0.tar.gz
.
File metadata
- Download URL: mlflow-ray-serve-0.2.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15597f59110cb3309fef06d6f553fd698720709723a9d7d9004f062e1eb3fed4 |
|
MD5 | b473137df8cbe49909a420a97c8bb8c3 |
|
BLAKE2b-256 | 6e1a252f1e19209f5f52c9c913eb83ca287bc0f5dd2ef89c67ccd5dd089f4b3a |
File details
Details for the file mlflow_ray_serve-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: mlflow_ray_serve-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7816b836b04b12493c3a17bf17a96bca5cac74582eeaf126d9f17dbe5d417b6d |
|
MD5 | 47f237efd055518a13b5133cbdbda90e |
|
BLAKE2b-256 | 49072f3984ea9c684dc781314af32a8f5e5a04f4cf63a8c37965695793f44a84 |