 version must be a valid registered model version.silent_daemon: set to True to suppress the output of the daemon (i.e., redirect stdout and stderr to /dev/null). If False, the daemon output will be redirected to a log file.

blocking: set to True to run the service in the context of the current process and block until the service is stopped instead of running the service as a daemon process. Useful for operating systems that do not support daemon processes.

model_uri: The URI of the model to be deployed. This can be a local file path, a run ID, or a model name and version.

workers: The number of workers to be used by the MLflow prediction server.

mlserver: If True, the MLflow prediction server will be started as a MLServer instance.

timeout: The timeout in seconds to wait for the MLflow prediction server to start or stop.

Run inference on a deployed model

The following code example shows how you can load a deployed model in Python and run inference against it:

Load a prediction service deployed in another pipeline

import json

import requests

from zenml import step

from zenml.integrations.mlflow.model_deployers.mlflow_model_deployer import (

MLFlowModelDeployer,

from zenml.integrations.mlflow.services import MLFlowDeploymentService

# Load a prediction service deployed in another pipeline

@step(enable_cache=False)

def prediction_service_loader(

pipeline_name: str,

pipeline_step_name: str,

model_name: str = "model",

) -> None:

"""Get the prediction service started by the deployment pipeline.

Args:

pipeline_name: name of the pipeline that deployed the MLflow prediction

server

step_name: the name of the step that deployed the MLflow prediction

server

running: when this flag is set, the step only returns a running service

model_name: the name of the model that is deployed

"""

# get the MLflow model deployer stack component

model_deployer = MLFlowModelDeployer.get_active_model_deployer()

# fetch existing services with same pipeline name, step name and model name