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.
Examples#
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()
Tip
You can specify which fields to include in the returned table with the columns
argument.
For examples, see API reference ≫ fetch_model_versions_table()
.
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 forModelVersion
objects-
fetch_model_versions_table()
→ only forModel
objectsNote
The
Project
class has a similar method for downloading the runs and models table, respectively:
API reference pages#
init_model()
functionModel
classinit_model_version()
functionModelVersion
class