Skip to content

Query metadata from model registry#

Model registry is deprecated

The model registry feature is deprecated. This includes:

  • The Models section in the web app.
  • The Model and ModelVersion objects of the API.

The feature will be deactivated on 2025-04-01.

For examples of model lifecycle management using experiments, see:

For how to migrate your models, see Migrate from model registry to experiments.

By initializing a Model or ModelVersion object, you can query and download metadata and files stored for that model or its version.

Use the Neptune ID and available methods to fetch what you need, in the same way as you would for runs.

Manage model metadata with experiments

We recommend using runs to manage model metadata. Runs come with extra features such as group tags, custom views, and dashboards, offering rich comparison and visualization support.

For details, see Logging model metadata with runs.

Downloading a model signature, if it exists
import neptune

model = neptune.init_model(with_id="CLS-PRE")  # ID of existing model

if model.exists("model/signature"):
    model["model/signature"].download()

In the above example, CLS-PRE is the ID of the model.

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.

Listing all versions of a model
import neptune

model = neptune.init_model(with_id="CLS-PRE")

model_versions_df = model.fetch_model_versions_table().to_pandas()

To filter the model versions by a custom field and condition, you can pass an NQL string to the query argument.

Fetch model versions with particular dataset hash, include stage and test accuracy, sort by model size
model_versions_df = model.fetch_model_versions_table(
    query="(`data_version`:artifact = 9a113b799082e5fd628be178bedd52837bac24e91f",
    columns=["sys/stage", "model_size", "test/acc"],
    sort_by="model_size",
).to_pandas()

For the syntax and examples, see the Neptune Query Language (NQL) reference.

Fetching validation metrics of a model version#

import neptune

model_version = neptune.init_model_version(with_id="CLS-PRE-4")

val_metrics = model_version["validation/metrics"].fetch()

In the above example, CLS-PRE-4 is the ID of the model version.