mlserver-mlflow provides an MLflow runtime for MLServer, allowing users to serve models logged with MLflow using the MLServer inference server. It's currently at version 1.7.1 and maintains a release cadence aligned with MLServer's development, receiving updates for bug fixes and compatibility with new MLflow/MLServer versions.
pip install mlserver-mlflowVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically use `MLflowRuntime` to load an MLflow model and perform an inference. It first creates a dummy MLflow model and logs it locally, then uses its URI to instantiate `MLflowRuntime` within MLServer's `ModelSettings`, loads the model, and makes a prediction. The `asyncio.run(main())` block executes the asynchronous model loading and inference.
Refer to the MLServer 1.x documentation for updated `ModelSettings`, `InferenceRequest`, and `InferenceResponse` formats. Ensure `mlserver` itself is `^1.0.0`.
Explicitly install all required model dependencies in your MLServer environment (e.g., `pip install xgboost`). For complex environments, consider building a custom Docker image for your `mlserver-mlflow` deployment that includes all necessary packages.
Carefully verify the `uri` parameter in your `ModelSettings` (or `model-settings.json`). Ensure it's a valid MLflow model URI (e.g., `models:/my_model/Production`, `runs:/<run_id>/path/to/artifact`, or `file:///absolute/path/to/model_dir`). If using `models:/` or `runs:/` schemes, ensure your MLflow tracking server or registry is running and accessible.
Install the package: `pip install mlserver-mlflow`
Identify and install the missing dependency. For example, `pip install scikit-learn`. For comprehensive dependency management, ensure your deployment environment matches the MLflow model's `conda_env` or `pip_requirements`.
Double-check the `uri` in your `ModelSettings` (or `model-settings.json`). Verify the model's existence in your MLflow Tracking Server or file system. Ensure network connectivity to the MLflow Tracking Server if using remote URIs.