Skip to content

Register a model#

Open example in Colab

Table view with models

For each ML model that you're working with, you can create a model object in Neptune and track any related metadata.

See example models in Neptune  Browse code examples 

Creating a Model object#

The Model object is suitable for storing general metadata that is shared by all versions of the model. For example:

  • Model signature
  • Validation datasets
  • Description of model's purpose

Create model through API#

Import Neptune and call the init_model() function:

import neptune

model = neptune.init_model(
    key="MODEL_KEY",  # must be uppercase and unique within the project
    name="A name for your model",  # optional
)

Alternatively, you can use the class constructor:

from neptune import Model

model = Model(key="PRETRAINED")

To see the model in Neptune, navigate to the Models section of your project.

Create model in app#

  1. In the Models section of your project, click Create new model.
  2. Enter a key and optionally a name and description for your model.

Now you can log metadata to the model in your Python code.

import neptune

model = neptune.init_model(
    with_id="CLAS-PRETRAINED",  # Your model ID here
)
How do I find the ID?

The Neptune ID is a unique identifier for the object. It's shown in the leftmost column of the table view.

The ID is stored in the system namespace, in the "sys/id" field.

Logging metadata to the model#

Track model metadata by assigning them to the model object:

model_info = {"size_limit": 50.0, "size_units": "MB"}
model["model"] = model_info

Upload the model signature and other data with the upload() method:

model["model/signature"].upload("model_signature.json")

Track dataset versions with the track_files() method:

model["data/train"].track_files("data/train.csv")
model["data/validation/dataset/v0.1"].track_files("s3://datasets/validation")

To stop the connection to Neptune and sync all data, call the stop() method and execute the script or cell:

model.stop()

To see the model in Neptune, click the link in the console output.

Next steps#