Skip to main content

Deployments using the registry

To make a deployment that uses the models in the registry, call mb.get_model in your inference function.

Suppose you have example_model stored in the registry. You can build an inference function that loads it:

def example_deployment(a: int):
model = mb.get_model("example_model")
return model.predict(a)

Or, suppose you have one model per customer stored in the registry. You can load different models on demand:

def example_deployment(customer_id: str, a: int):
model = mb.get_model(f"customer_models/{customer_id}")
return model.predict(a)

At inference time the deployment will fetch the model and use it to make a prediction.

tip

Models are cached in the deployment so subsequent calls to get_model are instant.