Flavors: One Model, Many Lenses

Sklearn, PyTorch, TensorFlow… and the universal pyfunc.

0/2 done

Flavors = format choices

What a flavor is

A flavor is a serialization format that MLflow understands. When you log a model it can be stored in multiple flavors at once — for example as both sklearn and pyfunc. Consumers load whichever lens they prefer.

import mlflow.sklearn, mlflow.pyfunc

# Native flavor — you keep the sklearn API
sk_model = mlflow.sklearn.load_model('runs:/<id>/model')
sk_model.predict_proba(X)

# Generic flavor — same model, simpler API
py_model = mlflow.pyfunc.load_model('runs:/<id>/model')
py_model.predict(X)

The pyfunc flavor is the lowest common denominator. It's what serving infrastructure (KServe, SageMaker, mlflow models serve) targets so it doesn't need to know what framework you used.

Analogy

A flavor is a document export: the same essay can be exported as .docx, .pdf and .html. The content is identical, but each format suits a different reader (Word users, printers, browsers). pyfunc is the plain-text version everyone can open.

Reading in progress · 0 of 2 activities done