Skip to main content

About the model registry

The model registry enables you to manage models separately from deployments. This is most useful when your use case requires one of the following:

  • Versioning the model separately from the code of the deployment
  • Using the same model in multiple deployments
  • Loading different models dynamically based on runtime parameters

Using the registry is simple: Call mb.add_model to add a model to the registry, and later mb.get_model to retrieve that model back into your Python environment.

# Create a simple model
from sklearn import linear_model

lm = linear_model.LinearRegression()
lm.fit([[1], [2], [3]], [2, 4, 6])

# Add the model to the registry, calling it "my_model"
mb.add_model(name="my_model", model=lm)

# Later, retrieve the model in your inference function
lm = mb.get_model("my_model")

A typical workflow using the registry is:

  1. Datasets are used to store the training data
  2. Training jobs refresh the dataset, train a new models, and upload them to the model registry
  3. Deployments fetch the new models at inference time, giving better predictions

Learn more