Fork a run
3 minute read
Use fork_from
when you initialize a run with wandb.init()
to “fork” from an existing W&B run. When you fork from a run, W&B creates a new run using the run ID
and step
of the source run.
Forking a run enables you to explore different parameters or models from a specific point in an experiment without impacting the original run.
- Forking a run requires
wandb
SDK version >= 0.16.5 - Forking a run requires monotonically increasing steps. You can not use non-monotonic steps defined with
define_metric()
to set a fork point because it would disrupt the essential chronological order of run history and system metrics.
Start a forked run
To fork a run, use the fork_from
argument in wandb.init()
and specify the source run ID
and the step
from the source run to fork from:
Using an immutable run ID
Use an immutable run ID to ensure you have a consistent and unchanging reference to a specific run. Follow these steps to obtain the immutable run ID from the user interface:
-
Access the Overview Tab: Navigate to the Overview tab on the source run’s page.
-
Copy the Immutable Run ID: Click on the
...
menu (three dots) located in the top-right corner of the Overview tab. Select theCopy Immutable Run ID
option from the dropdown menu.
By following these steps, you will have a stable and unchanging reference to the run, which can be used for forking a run.
Continue from a forked run
After initializing a forked run, you can continue logging to the new run. You can log the same metrics for continuity and introduce new metrics.
For example, the following code example shows how to first fork a run and then how to log metrics to the forked run starting from a training step of 200:
Rewind and forking compatibility
Forking compliments a rewind
by providing more flexibility in managing and experimenting with your runs.
When you fork from a run, W&B creates a new branch off a run at a specific point to try different parameters or models.
When you rewind a run, W&B let’s you correct or modify the run history itself.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.