0Pricing
MLOps Academy · Lezione

Il model flavor di MLflow

Confezioni i modelli con le relative dipendenze e signature.

Il model flavor di MLflow è una lezione MLOps Academy gratuita su CoddyKit. Questa è la lezione 2 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento MLOps Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso MLOps Academy include 4 lezioni in totale.

Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.

Beyond a Raw File

A bare pickle is just bytes. MLflow wraps your model in a self-describing folder so anyone can load it without guessing how. 📦

What Is a Flavor?

An MLflow flavor is a known format, like sklearn or pytorch, that tells MLflow exactly how to save and load that model.

One Model, Many Flavors

A single saved model can carry several flavors. That lets different tools load it their own way from the same artifact.

Save with a Flavor

Use the matching module to log a model. For scikit-learn you call mlflow.sklearn.log_model inside a run.

import mlflow.sklearn
mlflow.sklearn.log_model(model, name='model')

The MLmodel File

Every saved model has an MLmodel YAML file listing its flavors, signature, and how to reload it. It is the model's ID card.

Dependencies Travel Too

MLflow records the libraries your model needs in a conda.yaml or requirements file, so the same environment can be rebuilt later.

The pyfunc Flavor

Most models also get the universal pyfunc flavor. It exposes one simple predict call, no matter the framework underneath. 🔑

Load as pyfunc

Loading via pyfunc gives you a generic object with predict, so your serving code stays the same across frameworks.

import mlflow.pyfunc
m = mlflow.pyfunc.load_model('runs:/<id>/model')
m.predict(X)

Load Back Native

You can also reload in the original framework with the matching loader, getting the full native object instead of the generic wrapper.

model = mlflow.sklearn.load_model('runs:/<id>/model')

Custom pyfunc Models

No built-in flavor fits? Subclass PythonModel and write your own predict to wrap any logic into the pyfunc format.

class MyModel(mlflow.pyfunc.PythonModel):
    def predict(self, ctx, X):
        return self.run(X)

Why It Matters

Flavors make a model truly portable: training, registry, and serving all speak the same format without bespoke glue code.

Quick Check

Let's check your grasp of MLflow flavors.

Recap

An MLflow model is a self-describing folder with flavors, an MLmodel file, and pinned deps, loadable natively or as universal pyfunc. 🎉

Domande Frequenti

La lezione «Il model flavor di MLflow» è gratuita?

Sì — il testo completo di «Il model flavor di MLflow» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso MLOps Academy, passa a CoddyKit PRO. Il corso MLOps Academy include 4 lezioni in totale.

Cosa imparerò in «Il model flavor di MLflow»?

Confezioni i modelli con le relative dipendenze e signature. Eserciti MLOps Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.

Ho bisogno di esperienza per iniziare MLOps Academy?

Non è richiesta alcuna esperienza precedente. MLOps Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 2 di 4.

Quanto tempo richiede la lezione «Il model flavor di MLflow»?

La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.

Posso scrivere ed eseguire codice in questa lezione MLOps Academy?

Sì. Ogni lezione MLOps Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.

Tutte le lezioni di questo corso

  1. Serializzare con Pickle e Joblib
  2. Il model flavor di MLflow
  3. Esportare in ONNX per la portabilità
  4. Definire signature e schema del modello
← Torna a MLOps Academy