run ID and step. After you initialize a forked run, you can continue logging to the new run independently from the source run.
- Forking a run requires
wandbSDK 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.
fork_from parameter in wandb.init() to fork from an existing run. Specify the source run’s unique run ID and the step you want to start the forked run from.
See Unique run identifiers to learn more about run IDs and how to locate them.
Fork from a previously logged run
The following code snippet demonstrates how to fork from a run that you previously logged to W&B. This might occur if you want to fork from a run in a different script or notebook. Or if someone else logged the source run that you want to fork from. Replace<source-run-id>, <project>, and <entity> with your own values.
Fork from a run in the same script
The following code snippet shows how to fork from a run within the same script. This might occur if you want explore different parameters or models from a specific point within the same script or notebook.original_run.id property to obtain the unique run ID of the original run.
Example script
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. Copy and paste the following code into a Python script or notebook cell. Replace<project> and <entity> with your own values.
Rewind and forking compatibilityForking 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.