Manage model stage
This example assumes using tags to indicate model stage.
To change the model stage:
-
Initialize the run representing the model:
How do I find the ID?
The Neptune ID is a unique identifier for the run. The Experiments tab displays it in the leftmost column.
In the run structure, the ID is stored in the system namespace (
sys
).-
If the run is active, you can obtain its ID with
run["sys/id"].fetch()
. For example: -
If you set a custom run ID, it's stored at
sys/custom_run_id
:
-
-
Delete the tag for the previous stage:
-
Add the tag for the new stage:
-
To stop the connection to Neptune and sync all data, call the
stop()
method:
See in Neptune  See example code on GitHub 
Conditionally changing the stage#
You can make the stage transition conditional by fetching the relevant metadata from the run and checking the value.
The following code snippet fetches an accuracy value from the logged metrics, then compares it against a threshold of 0.9 before making the change:
run = neptune.init_run(
with_id="CLS-56",
capture_hardware_metrics=False,
capture_stderr=False,
capture_stdout=False,
capture_traceback=False,
git_ref=False,
source_code=[],
)
val_acc = run["validation/acc"].fetch()
if val_acc <= 0.7:
run["sys/tags"].remove("development")
run["sys/tags"].add("archived")