Fork an experiment
Forking refers to creating a run based on an existing experiment run. This way, you can restart a run at a particular step.
To fork an experiment, create a run and specify the parent run and step to fork from:
from neptune_scale import Run
run = Run(
experiment_name="swim-further",
fork_run_id="likable-barracuda", # parent run ID
fork_step=102,
)
To get a link to the experiment in the Neptune web app:
run = Run(experiment_name=...)
run.get_experiment_url()
For details, see Construct Neptune URLs.
Forking and inheritance
The new run inherits all metrics up to and including the fork point specified by the fork_step
argument.
A child run inherits the following metadata from its parent:
Metadata | Attribute type or path | How you log it |
---|---|---|
Metrics | FloatSeries attributes | run.log_metrics=(...) |
Tags | StringSet | run.add_tags(tags=...) or via tags management in the app |
Description | sys/description | run.log_configs(data={"sys/description": "..."}) or in the app |
Configs and other single values logged with log_configs()
aren't inherited automatically.
Set step for series
When logging metrics to the child run, steps after the fork point become part of the experiment lineage:
run = Run(
...,
fork_step: 100,
)
for step in epoch:
# your training loop
run.log_metrics(
data={"loss": 0.11, "acc": 0.81},
step=101, # or 100.1, for example
)
When viewing charts in the web app, if there's a gap between the fork step and the next logged step, Neptune linearly interpolates the values between those steps.
Before and at the fork step, the child run can log values without errors:
- If the pre-fork step exists in the parent run, new values logged at that step are ignored.
- If the pre-fork step doesn't exist in the parent run, you can display such data points in Runs mode with the Show inherited metrics setting disabled.