Skip to content

Query metadata from the model registry#

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.


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"):

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()

Filtering by query#

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"],

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.

Difference between model and run#

The available methods for run and model objects are the same, with the following notable exceptions:

  • change_stage() → only for ModelVersion objects
  • fetch_model_versions_table() → only for Model objects


    The Project class has a similar method for downloading the runs and models table, respectively:

API reference pages#