05. Model Registry
The model registry is MLflow's mechanism for managing model versions through their lifecycle: staging, production, and archival. Without a registry, "the current model" is whoever uploaded it last. With a registry, every model has an owner, a stage, and an approval trail.
Register a model from a run:
from mlflow.tracking import MlflowClient
client = MlflowClient()
# Register model from completed run
model_uri = "runs:/<run_id>/model"
client.register_model(
model_uri=model_uri,
name="spam-classifier"
)
This creates a new model version under the spam-classifier model name. Each training run that produces a model can become a new version.
Local verification checkpoint
Run the smallest example from this chapter in a local workspace and record the package version, runtime, data path, and observed output. If the result depends on model size, vector count, CPU/GPU backend, or available memory, note that constraint beside the exercise so the lesson remains reproducible.
Local verification checkpoint
Run the smallest example from this chapter in a local workspace and record the package version, runtime, data path, and observed output. If the result depends on model size, vector count, CPU/GPU backend, or available memory, note that constraint beside the exercise so the lesson remains reproducible.
Complete three training runs with different hyperparameters. Register each model. List all versions via the API. Transition one to Production. Verify in the MLflow UI that the production model is marked distinctly.