Skip to content

Resume a run#

To access or update an existing run, you can reinitialize it by passing its ID to the with_id argument.

This lets you:

  • 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.
  • The Python file from which a run is resumed is not snapshotted by default.

    However, you can upload it by providing the path to the source_files argument of the init_run() call. For details, see Logging source code.

To resume a run:

  1. Obtain the Neptune ID of the run.

    IDs highlighted in the Neptune app

    If the run is already initialized in the code, you can obtain it programmatically with:

    run_id = run["sys/id"].fetch()
  2. Initialize the run with the ID:

    run = neptune.init_run(with_id="CLS-123")
  3. Interact with the run as you normally would.

    You can overwrite existing fields, delete fields, or create new ones.

Continue logging to an existing run#

You can update an existing run with new metadata by creating new namespace and fields.

Start by reinitializing the run in your code:

import neptune

run = neptune.init_run(with_id="CLS-123")

Then use the run object to continue logging metadata as needed.

Log some score you forgot about
run["f1_score"] = f1_score
Resume logging from a checkpoint
# 450 is the epoch from where you want to resume training process
checkpoint = 450

# Continue training as usual
for epoch in range(checkpoint, 1000):

Editing existing metadata#

To edit the value of an existing field, you overwrite it with different data of the same type.

Previously logged
import neptune

run = neptune.init_run()  # run ID becomes CLS-44 (for this example)
run["learning_rate"] = 0.01
Assign a new value to the existing field
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.


Deleting metadata from a run#

See Trash and delete data.

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.

Initialize in read-only mode
import neptune

run = neptune.init_run(with_id="CLS-123", mode="read-only")
Fetch some logged metadata
dataset_hash = run["data_version"].fetch_hash()
Download snapshot of logged model weights
Query some basic metadata from the system namespace
owner = run["sys/owner"].fetch()