Overwrite logged metadata#
This page explains the mechanics to overwrite or override metadata logged to runs or other objects.
General principle#
If you assign new data to an existing field, that data will overwrite the data previously logged to that field.
Exceptions
Iterative logging methods do not overwrite previous values when resuming a run. These are:
append()
– the passed value is added to the end of the existing series.extend()
– the passed set of values is added to the end of the existing series.track_files()
– passing a new file path will add tracking of that file to the overall artifact field.
Overriding regular fields#
Caution
Overwriting the metadata stored under a namespace or field cannot be undone.
To edit the value of an existing field, you overwrite it with new data of the same type.
If the run that you want to modify is already active, you can simply re-execute the code that assigns metadata to the field.
>>> run = neptune.init_run()
>>> run["learning_rate"] = 0.01
>>> run["learning_rate"] = 0.02
Result
The value of the learning_rate
field has been changed to 0.02
instead of 0.01
.
Resuming an inactive run#
If the run that you wish to edit is already inactive, you need to reinitialize it in your code.
>>> run = neptune.init_run(with_id="<ID_of_previous_run>")
>>> run["learning_rate"] = 0.02
How do I find the ID?
If the run is active, you can also fetch its ID via API:
Overriding series fields#
If you resume a run and continue logging to an existing series field, the new values won't overwrite the previous ones.
To overwrite the series field (have it start from a new set of values), you need to pop or delete the field first.
>>> print(run.exists("train/accuracy"))
True
>>> del run["train/accuracy"]
>>> print(run.exists("train/accuracy"))
False
>>> for epoch in range(checkpoint, 1000):
... run["train/accuracy"].append(acc)
>>> # A new series is created under the original field
You can also change the field path to something else, which will preserve the old series.
Avoiding accidental overwrite#
In general, logging data of a different type to an existing field will automatically fail. In this case, Neptune assumes overwriting is not the intention and throws an exception.
Otherwise, if you frequently update existing runs, you should have some safeguard in place whenever you access fields that already have metadata assigned to them.
Using read only mode#
If you're just fetching metadata and not logging anything new, you can use read-only mode. This ensures that any initialized runs or other Neptune objects won't be modified.
import neptune
run = neptune.init_run(with_id="CLS-12", mode="read-only")
# Fetch some logged metadata
dataset_hash = run["data_version"].fetch_hash()
...
You can also set the connection mode with the NEPTUNE_MODE
environment variable.
Editing name, description, or tags#
You can edit basic information about runs and model objects directly in the Neptune app.
-
Next to the run ID, click the run menu () and select Show run information.
-
Edit the information as needed.
- When you're done, click the check mark ().
To learn more, see Edit name or description.
Related
- Learn more about read-only and other modes: Connection modes
- See how to resume any existing Neptune object: Log to an existing object
- You can also edit some system namespace fields manually. For details, see: System namespace overview
- Trash and delete data
- Query the Neptune API