Manage a W&B Sweep with the CLI

Pause, resume, and cancel a W&B Sweep with the CLI.

Use the W&B CLI to pause, resume, and cancel a sweep. The CLI’s sweep command uses flags such as --pause and --resume to control the sweep’s ability to create new W&B runs, with different effects on existing runs:

  • --pause: When you pause a sweep, the agent creates no new runs until you resume the sweep. Existing runs continue to execute normally.
  • --resume: When you resume a sweep, the agent continues creating new runs according to the search strategy.
  • --stop: When you stop a sweep, the agent stops creating new runs. Existing runs continue to completion.
  • --cancel: When you cancel a sweep, the agent immediately kills all currently executing runs and stops creating new runs.

Use the following guidance to pause, resume, and cancel a sweep. In each case, provide the sweep ID that was generated when you initialized a sweep.

Pause a sweep

Pause a sweep so it temporarily stops creating new runs. Runs that are already executing will continue to run until completion. Use the wandb sweep --pause command to pause a sweep. Provide the sweep ID that you want to pause.

wandb sweep --pause entity/project/sweep_ID

Resume a sweep

Resume a paused sweep with the wandb sweep --resume command. The sweep will start creating new runs again according to its search strategy. Provide the sweep ID that you want to resume:

wandb sweep --resume entity/project/sweep_ID

Stop a sweep

Finish a sweep to stop creating new runs while letting currently executing runs finish gracefully. Use the wandb sweep --stop command:

wandb sweep --stop entity/project/sweep_ID

Cancel a sweep

Cancel a sweep to immediately kill all running runs and stop creating new runs. This is the only sweep command that forcibly terminates existing runs. Use the wandb sweep --cancel command to cancel a sweep. Provide the sweep ID that you want to cancel.

wandb sweep --cancel entity/project/sweep_ID

For a full list of CLI command options, see the wandb sweep CLI Reference Guide.

Understanding sweep and run statuses

A sweep orchestrates multiple runs to explore hyperparameter combinations. Understanding how sweep status and run status interact is crucial for effectively managing your hyperparameter optimization.

Key differences

  • Sweep status controls whether new runs are created (Running, Paused, Stopped, Cancelled, Finished, Failed, Crashed)
  • Run status reflects the execution state of individual runs (Pending, Running, Finished, Failed, Crashed, Killed)

Best practices

  • Use --pause instead of cancel when you want to temporarily halt exploration without losing running experiments
  • Monitor individual run statuses to identify systematic failures
  • Use --stop for graceful termination when you’ve found satisfactory hyperparameters
  • Reserve --cancel for emergencies when runs are consuming excessive resources or producing errors