Advanced MLflow: Custom Flavors and Plugins

Package Preprocessing, Model, and Post-Processing Into One MLflow pyfunc Model So Every Consumer Gets the Same Prediction From One Call. (MLOPS: ABSOLUTE BEGINNERS TO PRO IN 100 DAYS - DAY 67)

By Sandip Das · · 4 min read

Advanced MLflow: Custom Flavors and Plugins
💡
Hey — It's Sandip Das 👋

In Day 66 we measured bias and added a fairness gate next to the accuracy check. Back in iris-mlops, there is a quieter risk: the FastAPI app, the batch job and the notebook each re-implement preprocessing, and sooner or later one of them gets it slightly wrong.

Today we fix that with MLflow's custom pyfunc flavor: one MLflow model that contains preprocessing, the classifier and readable output, loaded and served the same way everywhere. We also look at how MLflow plugins extend the platform itself.

📚 Key Learnings

  • What an MLflow flavor is and why python_function (pyfunc) is the universal one
  • Writing a custom mlflow.pyfunc.PythonModel with load_context and predict
  • Bundling preprocessing + model + post-processing into one artifact with a signature
  • When

    Read the full article on learnxops.com.

    Topics: 100 Days of MLOps, MLOps, ML, MLflow