Skip to content

Add your models to Model Registry

Comet has a sophisticated system for logging, registering, versioning, and deploying machine learning models. A model can be anything you want it to be---Comet makes no assumptions of what comprises a model.

The general steps in creating a Comet model pipeline are:

  1. Log a model using a Python SDK Experiment.
  2. Register an Experiment model.
  3. Track model versions of the registered model.
  4. Deploy a registered model.

Below we explore the second step about how to register a model in detail.

Register a model

After you log a model through an Experiment through the SDK, you can then register it. Registered models belong to a workspace, and are shared with your team there.

You can register an Experiment's model in three ways:

  1. Through the Register Model button on the Experiment UI's top right corner
  2. Through the Experiment's Asset tab in the Comet UI.
  3. Programmatically through the Comet Python SDK.

Register a model from Comet UI

After clicking on the Register Model button, a side bar will open up where you can choose a previously logged model to register into the Comet Model Registry.

Register Model

Here, you can give the registered model a name, a version, and set its visibility to Public or Private. Note that registered model names must be all lowercase, and version strings must use proper semantic versioning. Semantic versioning are strings like "1.0.0", "2.1.5", or "1.0.0-alpha". For more examples of "semver", see, for example, Understanding Semantic Versioning Specification.

On the other hand, if you have registered a model in this Workspace before, you see the following dialog:

Register Model

Here, you select one of the previous registered model names from the list, and again provide proper semantic versioning. Click Register your model.

Register a model from Comet SDK

You can also register an Experiment's model through the Python API.

Note

If you are registering the model in the same script where you logged the model, you can use Experiment.register_model(). If you are registering the model after the Experiment finished, you can use APIExperiment.register_model().

That would look similar to:

experiment.log_model("MNIST CNN", "./output")

experiment.register_model("MNIST CNN")
or
from comet_ml import API

api = API()

experiment = api.get("workspace-name/project-name/experiment-name")
experiment.register_model("MNIST CNN")

That's it! The "MNIST CNN" is the name of the Experiment model, and if you don't provide a registry model name, it will serve as the foundation for it as well. However, since registered model names have more constraints than Experiment model names, the registered model name becomes "mnist-cnn". Likewise, since we did not provide a version number, the string "1.0.0" was used as the default.

Update a registered model

Registered models belong to the workspace. In this manner, you can share your models with the workspace team. At the workspace view, you can select between viewing the Projects or the registered models.

Project View

Selecting a registered model's card in the Model Registry takes you to the detailed view of the registered model.

Project View

Here you can see the latest version of the registered model, and all previous versions as well. Comet Models are closely tied to Experiments and you can access all of the Experiment data in the registry by customizing your columns. You can manage your models by adjusting their tags or formally changing the model status.

You can also alter these settings programmatically using the Python API:

from comet_ml import API
api = API()
model = api.get_model(workspace=workspace, model_name=model_name)

model.set_status(version='1.1.0', status="Production")
model.add_tag(version='1.1.0', tag='new_tag')

Programmatically, you can delete these as well:

api.delete_registry_model(workspace, registry_name)
api.delete_registry_model_version(workspace, registry_name, version)
May. 17, 2024