About this page

This is an API reference for using MLflow in BentoML. Please refer to MLflow guide for more information about how to use MLflow in BentoML.

bentoml.mlflow.import_model(name: str, model_uri: str, *, signatures: dict[str, ModelSignatureDict | ModelSignature] | None = None, labels: dict[str, str] | None = None, custom_objects: dict[str, t.Any] | None = None, external_modules: t.List[ModuleType] | None = None, metadata: dict[str, t.Any] | None = None) bentoml.Model[source]#

Import MLflow model from a artifact URI to the BentoML model store.

  • name – The name to give to the model in the BentoML store. This must be a valid Tag name.

  • model_uri – The MLflow model to be saved.

  • signatures – Signatures of predict methods to be used. If not provided, the signatures default to {“predict”: {“batchable”: False}}. See ModelSignature for more details.

  • labels – A default set of management labels to be associated with the model. For example: {"training-set": "data-v1"}.

  • custom_objects – Custom objects to be saved with the model. An example is {"my-normalizer": normalizer}. Custom objects are serialized with cloudpickle.

  • metadata

    Metadata to be associated with the model. An example is {"param_a": .2}.

    Metadata is intended for display in a model management UI and therefore all values in metadata dictionary must be a primitive Python type, such as str or int.


A Model instance referencing a saved model in the local BentoML model store.


import bentoml

        "predict": {"batchable": True},
bentoml.mlflow.load_model(bento_model: str | bentoml._internal.tag.Tag | bentoml._internal.models.model.Model) mlflow.pyfunc.PyFuncModel[source]#

Load the MLflow PyFunc model with the given tag from the local BentoML model store.


bento_model – Either the tag of the model to get from the store, or a BentoML ~bentoml.Model instance to load the model from.


The MLflow model loaded as PyFuncModel from the BentoML model store.


import bentoml
pyfunc_model = bentoml.mlflow.load_model('my_model:latest')
pyfunc_model.predict( input_df )
bentoml.mlflow.get(tag_like: str | bentoml._internal.tag.Tag) Model[source]#

Get the BentoML model with the given tag.


tag_like – The tag of the model to retrieve from the model store.


A BentoML Model with the matching tag.

Return type



import bentoml
# target model must be from the BentoML model store
model = bentoml.mlflow.get("my_mlflow_model")
bentoml.mlflow.get_mlflow_model(tag_like: str | bentoml._internal.tag.Tag) mlflow.models.Model[source]#