t_series)

return result

ZenML Bento Builder stepOnce you have your bento service and runner defined, we can use the built-in bento builder step to build the bento bundle that will be used to serve the model. The following example shows how can call the built-in bento builder step within a ZenML pipeline.

from zenml import pipeline, step

from zenml.integrations.bentoml.steps import bento_builder_step

@pipeline

def bento_builder_pipeline():

model = ...

bento = bento_builder_step(

model=model,

model_name="pytorch_mnist",  # Name of the model

model_type="pytorch",  # Type of the model (pytorch, tensorflow, sklearn, xgboost..)

service="service.py:svc",  # Path to the service file within zenml repo

labels={  # Labels to be added to the bento bundle

"framework": "pytorch",

"dataset": "mnist",

"zenml_version": "0.21.1",

},

exclude=["data"],  # Exclude files from the bento bundle

python={

"packages": ["zenml", "torch", "torchvision"],

},  # Python package requirements of the model

The Bento Builder step can be used in any orchestration pipeline that you create with ZenML. The step will build the bento bundle and save it to the used artifact store. Which can be used to serve the model in a local setting using the BentoML Model Deployer Step, or in a remote setting using the bentoctl or Yatai. This gives you the flexibility to package your model in a way that is ready for different deployment scenarios.

ZenML BentoML Deployer step

We have now built our bento bundle, and we can use the built-in bentoml_model_deployer_step to deploy the bento bundle to our local HTTP server. The following example shows how to call the built-in bento deployer step within a ZenML pipeline.

Note: the bentoml_model_deployer_step can only be used in a local environment.

from zenml import pipeline, step

from zenml.integrations.bentoml.steps import bentoml_model_deployer_step

@pipeline

def bento_deployer_pipeline():

bento = ...

deployed_model = bentoml_model_deployer_step(

bento=bento