Serving Multiple Models to a Single Model Endpoint with MLflow

<p>In the world of machine learning, it is not uncommon to work on problems that, by their nature, require the development of multiple models. A common scenario could be a use case in the field of retail. Here, for example, we have different stores distributed across a region, each store containing different products. If we need to forecast sales for each store, let&rsquo;s say, we might have to train multiple machine learning models, one for each store. And if we go to the product level, the number of forecasters increases drastically.</p> <p><img alt="" src="https://miro.medium.com/v2/resize:fit:700/1*cDLpbOh0fW1fbh7n9vQVYQ.jpeg" style="height:467px; width:700px" /></p> <p>Foto de&nbsp;<a href="https://unsplash.com/es/@markuswinkler?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText" rel="noopener ugc nofollow" target="_blank">Markus Winkler</a>&nbsp;en&nbsp;<a href="https://unsplash.com/es/fotos/f57lx37DCM4?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText" rel="noopener ugc nofollow" target="_blank">Unsplash</a></p> <p>Naturally, we want our models to be consumed. Creating one endpoint for each model might increase the computational cost during the deployment process. To tackle this issue, we can package multiple models into one model. In this post, we will explore this approach when working with MLFlow and multiple models.</p> <h1>Custom Models</h1> <p>MLflow offers native support for the most common and well-known machine learning frameworks, such as scikit-learn, TensorFlow, or Spark. However, there are situations in which we may need to work with a different framework or when we require additional logic for preprocessing input and output data during both training and inference. To address these specific cases, MLflow provides a module that enables the creation of a wrapper around our custom model. This wrapper ensures compatibility with the MLflow framework.</p> <p><a href="https://python.plainenglish.io/serving-multiple-models-with-mlflow-8311ba7939c7">Visit Now</a></p>