Associating model versions with runs#
When you track an experiment in Neptune, the run gets a unique ID. By storing the ID of one or more runs in the metadata of a model, you unambiguously connect a given model version with a certain experiment.
To create a model version and associate it with a run:
-
Import Neptune and initialize a
ModelVersion
object:- The Neptune ID of the model
To use an existing model version, instead of the
model
parameter, use thewith_id
parameter and pass a model version ID:How do I find the ID?
The Neptune ID is a unique identifier for the object. It's displayed in the Details view and in the leftmost column of the table views.
The ID is stored in the system namespace. You can obtain it with
object["sys/id"].fetch()
. For example: -
Assign the run ID to a field of your choice.
Tip
If you don't have a connection open to the relevant run, you can:
- Reinitialize the run:
run = neptune.init_run(with_id="CLS-14")
- Enter the run ID manually:
model_version["run/id"] = "CLS-14"
- Reinitialize the run:
-
(optional) It can also be helpful to record the URL of the run:
Result
In Neptune, the run ID is logged in the run/id
field of the model version.
You can query the logged values from the model_version
object with:
run_id = model_version["run/id"].fetch()
run_url = model_version["run/url"].fetch()