Skip to main content
GitHub source Create, update, or manage a hyperparameter sweep. Provide a YAML config file to create a sweep. Define the search strategy, parameters, and metric to optimize in the config. Register the sweep with the W&B server and print the sweep ID and a command to start an agent. Provide a sweep ID (or full path entity/project/sweep_id) with a state flag (--stop, --cancel, --pause, or --resume) to manage an existing sweep. The sweep ID is a unique identifier for the sweep, generated by W&B when the sweep is created. You can find the sweep ID in the W&B App or in the output of the wandb sweep command when you create a new sweep. Examples: Create a new sweep from a YAML config file
wandb sweep sweep_config.yaml
Create a sweep in a specific project and team.
wandb sweep -p project -e entity sweep_config.yaml
Update an existing sweep’s configuration.
wandb sweep --update abcd1234 sweep_config.yaml
Stop a sweep
wandb sweep --stop entity/project/abcd1234
Cancel a sweep
wandb sweep --cancel abcd1234
Pause and later resume a sweep
wandb sweep --pause abcd1234
wandb sweep --resume abcd1234
Create a sweep with a local controller
wandb sweep --controller sweep_config.yaml
Attach existing runs to a new sweep. Replace run_ID_1 and run_ID_2 with the unique IDs (not sweep IDs) of the runs you want to attach.
wandb sweep -R run_ID_1 -R run_ID_2 sweep_config.yaml

Usage

wandb sweep [OPTIONS] CONFIG_YAML_OR_SWEEP_ID

Options

project

Set the project for sweep runs. Use ‘Uncategorized’ if not set.
FlagDefaultType
-p, --projectNoneSTRING

entity

Set the entity for sweep. Use the current user’s default entity if not set.
FlagDefaultType
-e, --entityNoneSTRING

controller

Start a local sweep controller after creating the sweep.
FlagDefaultType
--controllerFalseBOOL

verbose

Display verbose output.
FlagDefaultType
--verboseFalseBOOL

name

Set a display name for the sweep. Use the sweep ID if not specified.
FlagDefaultType
--nameNoneSTRING

program

Override the training program specified in the sweep config.
FlagDefaultType
--programNoneSTRING

settings

Set sweep settings
FlagDefaultType
--settingsNoneSTRING

update

Update an existing sweep configuration. Pass the sweep ID.
FlagDefaultType
--updateNoneSTRING

stop

Stop a sweep. Let active runs finish but do not start new runs.
FlagDefaultType
--stopFalseBOOL

cancel

Cancel a sweep. Kill active runs and stop starting new ones.
FlagDefaultType
--cancelFalseBOOL

pause

Pause a sweep. Temporarily stop starting new runs.
FlagDefaultType
--pauseFalseBOOL

resume

Resume a paused sweep.
FlagDefaultType
--resumeFalseBOOL

prior_runs

Attach an existing run to this sweep by ID. Specify multiple times to attach multiple runs.
FlagDefaultType
-R, --prior_runNoneSTRING

help

Show this message and exit.
FlagDefaultType
--helpFalseBOOL

CLI Help

Usage: sweep [OPTIONS] CONFIG_YAML_OR_SWEEP_ID

  Create, update, or manage a hyperparameter sweep.

  Provide a YAML config file to create a sweep. Define the search strategy,
  parameters, and metric to optimize in the config. Register the sweep with
  the W&B server and print the sweep ID and a command to start an agent.

  Provide a sweep ID (or full path `entity/project/sweep_id`) with a state
  flag (`--stop`, `--cancel`, `--pause`, or `--resume`) to manage an existing
  sweep.

  The sweep ID is a unique identifier for the sweep, generated by W&B when the
  sweep is created. You can find the sweep ID in the W&B App or in the output
  of the `wandb sweep` command when you create a new sweep.

  Examples:

  Create a new sweep from a YAML config file

  ```bash wandb sweep sweep_config.yaml ```

  Create a sweep in a specific project and team.

  ```bash wandb sweep -p project -e entity sweep_config.yaml ```

  Update an existing sweep's configuration.

  ```bash wandb sweep --update abcd1234 sweep_config.yaml ```

  Stop a sweep

  ```bash wandb sweep --stop entity/project/abcd1234 ```

  Cancel a sweep

  ```bash wandb sweep --cancel abcd1234 ```

  Pause and later resume a sweep

  ```bash wandb sweep --pause abcd1234 wandb sweep --resume abcd1234 ```

  Create a sweep with a local controller

  ```bash wandb sweep --controller sweep_config.yaml ```

  Attach existing runs to a new sweep. Replace run_ID_1 and run_ID_2 with the
  unique IDs (not sweep IDs) of the runs you want to attach.

  ```bash wandb sweep -R run_ID_1 -R run_ID_2 sweep_config.yaml ```

Options:
  -p, --project TEXT    Set the project for sweep runs. Use 'Uncategorized' if
                        not set.
  -e, --entity TEXT     Set the entity for sweep. Use the current user's
                        default entity if not set.
  --controller          Start a local sweep controller after creating the
                        sweep.
  --verbose             Display verbose output.
  --name TEXT           Set a display name for the sweep. Use the sweep ID if
                        not specified.
  --program TEXT        Override the training program specified in the sweep
                        config.
  --update TEXT         Update an existing sweep configuration. Pass the sweep
                        ID.
  --stop                Stop a sweep. Let active runs finish but do not start
                        new runs.
  --cancel              Cancel a sweep. Kill active runs and stop starting new
                        ones.
  --pause               Pause a sweep. Temporarily stop starting new runs.
  --resume              Resume a paused sweep.
  -R, --prior_run TEXT  Attach an existing run to this sweep by ID. Specify
                        multiple times to attach multiple runs.
  --help                Show this message and exit.