id parameter:
W&B encourages you to provide the name of the W&B Project where you want to store the run.
resume parameter to determine how W&B should respond. In each case, W&B first checks if the run ID already exists.
You can also specify
resume="auto" to let W&B to automatically try to restart the run on your behalf. However, you will need to ensure that you restart your run from the same directory. See the Enable runs to automatically resume section for more information.
For all the examples below, replace values enclosed within <> with your own.
Resume a run that must use the same run ID
If a run is stopped, crashes, or fails, you can resume it using the same run ID. To do so, initialize a run and specify the following:- Set the
resumeparameter to"must"(resume="must") - Provide the run ID of the run that stopped or crashed
Resume a run without overriding the existing run
Resume a run that stopped or crashed without overriding the existing run. This is especially helpful if your process doesn’t exit successfully. The next time you start W&B, W&B will start logging from the last step. Set theresume parameter to "allow" (resume="allow") when you initialize a run with W&B. Provide the run ID of the run that stopped or crashed. The following code snippet shows how to accomplish this with the W&B Python SDK:
Enable runs to automatically resume
The following code snippet shows how to enable runs to automatically resume with the Python SDK or with environment variables.- W&B Python SDK
- Shell script
The following code snippet shows how to specify a W&B run ID with the Python SDK.Replace values enclosed within
<> with your own:train.py in a directory called Users/AwesomeEmployee/Desktop/ImageClassify/training/. Within train.py, the script creates a run that enables automatic resuming. Suppose next that the training script is stopped. To resume this run, you would need to restart your train.py script within Users/AwesomeEmployee/Desktop/ImageClassify/training/ .
If you can not share a filesystem, specify the
WANDB_RUN_ID environment variable or pass the run ID with the W&B Python SDK. See the Custom run IDs section in the “What are runs?” page for more information on run IDs.Resume preemptible Sweeps runs
Automatically requeue interrupted sweep runs. This is particularly useful if you run a sweep agent in a compute environment that is subject to preemption such as a SLURM job in a preemptible queue, an EC2 spot instance, or a Google Cloud preemptible VM. Use themark_preempting function to automatically requeue interrupted sweep runs. For example: