Skip to content

Logging to existing object#

You can resume logging to an already existing run or other Neptune object by passing its ID at initialization.

This lets you add new data or visualizations to a previously closed run and facilitates multi-stage training.

  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",
    )
    
    project = neptune.init_project(
        name="workspace-name/project-name", # (1)
    )
    
    1. The full project name. For example, "ml-team/classification". To copy it, navigate to the project settingsProperties.
  3. Log metadata to the object as you normally would.

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

Example#

import neptune.new as 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"].log(0.75)
  ...

Good to know

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

See in Neptune 

Back to top