Documentation
Search…
wandb.sweep
Initialize a hyperparameter sweep.
1
sweep(
2
sweep: Union[dict, Callable],
3
entity: str = None,
4
project: str = None
5
) -> str
Copied!
To generate hyperparameter suggestions from the sweep and use them to train a model, call wandb.agent with the sweep_id returned by this command. For command line functionality, see the command line tool wandb sweep (https://docs.wandb.ai/ref/cli/wandb-sweep).
Args
Text
sweep
dict, SweepConfig, or callable. The sweep configuration (or configuration generator). If a dict or SweepConfig, should conform to the W&B sweep config specification (https://docs.wandb.ai/guides/sweeps/configuration). If a callable, should take no arguments and return a dict that conforms to the W&B sweep config spec.
entity
str (optional). An entity is a username or team name where you're sending runs. This entity must exist before you can send runs there, so make sure to create your account or team in the UI before starting to log runs. If you don't specify an entity, the run will be sent to your default entity, which is usually your username. Change your default entity in Settings under "default location to create new projects".
project
str (optional). The name of the project where you're sending the new run. If the project is not specified, the run is put in an "Uncategorized" project.
Returns
Text
sweep_id
str. A unique identifier for the sweep.

Examples:

Basic usage
1
# this line initializes the sweep
2
sweep_id = wandb.sweep({'name': 'my-awesome-sweep',
3
'metric': {'name': 'accuracy', 'goal': 'maximize'},
4
'method': 'grid',
5
'parameters': {'a': {'values': [1, 2, 3, 4]}}})
6
7
# this line actually runs it -- parameters are available to
8
# my_train_func via wandb.config
9
wandb.agent(sweep_id, function=my_train_func)
Copied!
Last modified 7h ago
Copy link