Fork an experiment
Forking refers to creating a run based on an existing experiment run. This way, you can restart an experiment from 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=100,
)
Inheritance
All metrics up to and including the fork step are inherited.
When the child run continues logging values to metrics, points logged at or after the fork step 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, # also OK: 100 or 100.1
)
Inherited attributes
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.
Parent selection
If a run and its child are created close to each other, it can result in the requested parent not yet being available on the server.
In the case that the requested parent can't be retrieved, Neptune instead sets the parent to the experiment's latest head run.
Log points before the fork step
For an inherited series, a child run can log points for pre-fork steps, as long as they come after the parent's last logged step:
ParentMaxStep < ChildStep ≤ ForkStep
→ OK
ChildStep ≤ ParentMaxStep ≤ ForkStep
→ Error
When viewing the child run's metrics and the mode in the table toolbar is set to Runs:
- Show inherited metrics enabled: Points inherited from the parent are displayed for steps before the fork point, otherwise points logged directly by the child run are displayed.
- Show inherited metrics disabled: Only points directly logged by the child run itself are displayed.
If a series attribute doesn't exist in the parent run, the child run can log points starting from any step:
run = Run(
...,
fork_step: 100,
)
for step in some_range:
run.log_metrics(
data={"new_metric": 0.123}, # "new_metric" doesn't exist in the parent run
step=1, # OK
)
Such points are passed on to further descendant runs.
Get experiment URL
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.