Skip to content

Resuming a run or other object#

To resume a run, you can pass its ID to the with_id argument at initialization. This lets you add new data or visualizations to a previously closed run and facilitates multi-stage training.

You can use this method to continue logging to any existing Neptune object (run or model objects). You can also modify existing data by overriding that field with a new value, or delete data from the object.

To resume a run or other object:

  1. Obtain the Neptune ID of the object to resume.

    • Each object's ID is stored in the sys/id field.
    • You can see it displayed in the leftmost column of the table view.
    • If the object has been initialized in the code, you can obtain it programmatically with

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

    run = neptune.init_run(
        with_id="CLS-123",
    )
    
    model = neptune.init_model(
        with_id="CLS-PRE",
    )
    
    model_version = neptune.init_model_version(
        with_id="CLS-PRE-11",
    )
    
  3. Log metadata to the object as you normally would.

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

Example#

import neptune

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

# Download snapshot of model weights
run["train/model_weights"].download()

# 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)
  ...

Good to know

  • There is no limit to the number of times you can resume an object.
  • 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.

Initializing a Neptune project#

You can also treat your Neptune project as an object and log metadata to it via the Neptune API.

Data logged like this will appear under the Project metadata tab of your project.

For more, see Logging project-level metadata.