Skip to main content

mb.add_model(name, model, ...)

Adds a model to the model registry. The registry is updated with the new model if a an entry with that name already exists.

Multiple models

If you're adding multiple models to the registry, use mb.add_models instead.

Parameters

  • name: str The name of the model in the registry. Models are stored by paths, like files, so you can use forward slashes for organization.
  • model: Any The model object to store in the registry. A Python variable, not a path to a .pkl file.
  • metrics: Optional[Dict[str, Any]] Optional, the metrics to associate with this model. Metrics must be JSON-serializable with str values for keys.
  • serializer: Optional["cloudpickle"] Optional, specify a different serializer to use. Default value is None which uses the pickle module. Learn mode

Returns

No value is returned. A success status message is printed if the command is successful.

Examples

Adding a model

mb.add_model("example_model", my_model)

Adding a model in a "finance" directory

mb.add_model("finance/example_model", my_model)

Adding a model with metrics

mb.add_model("example_model", my_model, metrics={ "precision": 0.95 })

Storing a model with cloudpickle

mb.add_model("my_model", my_model, serializer="cloudpickle")

See also