Resume a run#
To access or update an existing run, call neptune.init_run()
and specify the run in one of the following ways:
- Pass the run's auto-generated Neptune ID to the
with_id
argument. - If you set a custom run ID when the run was created (with the
custom_run_id
argument or theNEPTUNE_CUSTOM_RUN_ID
environment variable), pass it to thecustom_run_id
argument.
When you've resumed the run, you can:
- Add new data (such as visualizations or evaluation metrics) to a previously closed run
- Do multi-stage training more easily
- Overwrite a field with a new value
- Delete data from the run
- Fetch metadata in read-only mode
Good to know
- There is no limit to the number of times you can resume a run.
- By default, the Python file from which a run is resumed does not overwrite the record of the original entry-point file. However, you can log the file path manually by providing it to the
source_files
argument of theinit_run()
call. For details, see Logging source code.
To resume a run:
-
Obtain the run identifier.
The auto-generated identifier is stored in the run's
sys/id
field.A custom identifier is stored the run's
sys/custom_run_id
field. -
Initialize the run with the ID:
-
Interact with the run as you normally would.
You can overwrite existing fields, delete fields, or create new ones.
Related
Continue logging to an existing run#
You can update an existing run with new metadata by creating new namespace and fields.
Resume the run first, then use the run
object to continue logging metadata as needed.
# 450 is the epoch from where you want to resume training process
checkpoint = 450
# Continue training as usual
for epoch in range(checkpoint, 1000):
run["train/accuracy"].append(0.75)
...
Editing existing metadata#
To edit the value of an existing field, you overwrite it with different data of the same type.
import neptune
run = neptune.init_run() # run ID becomes CLS-44 (for this example)
run["learning_rate"] = 0.01
import neptune
run = neptune.init_run(with_id="CLS-44")
run["learning_rate"] = 0.02
The value of the "learning_rate"
field has been changed to 0.02
instead of 0.01
.
Related
Learn more: Overwriting logged metadata
Deleting metadata from a run#
Accessing a run in read only mode#
If you're just fetching metadata and not logging anything new, you can reinitialize the run in read only mode. This ensures that the run's metadata won't be modified.
import neptune
run = neptune.init_run(with_id="CLS-123", mode="read-only")
Related
- To learn more about read only and other modes, see Connection modes.
- Query the Neptune API
- Add a new field to existing runs