- Configure your training script to create and track hyperparameter combinations with Weights & Biases. See Add Weights & Biases to your code for examples.
- Define a configuration file for your sweep.
dtzl1o7u), or include the entity and project as a path:
entity: Your Weights & Biases team name.project: The name of the project where you want Weights & Biases to store the output of the run. If you don’t specify the project, Weights & Biases puts the run in a project called “Uncategorized”.sweep_ID: The pseudo-random, unique ID that Weights & Biases generates.
- CLI
- Python script or notebook
Use the For graceful shutdown when you interrupt the agent (for example, with
wandb agent command to start a sweep. Provide the sweep ID that Weights & Biases returns when you initialize the sweep.Replace [SWEEP-ID] with your sweep ID in the following command:Ctrl+C), use wandb agent --forward-signals [SWEEP-ID] so the current run receives the signal and can shut down cleanly. See Signal handling and sweep runs for details.Limit the number of runs a sweep agent tries
By default, random and Bayesian searches run indefinitely, so cap how many runs an agent attempts. Specify the number of runs a sweep agent should try to bound its work. The following code snippets demonstrate how to set a maximum number of runs with the CLI and within a Jupyter notebook or Python script.- CLI
- Python script or notebook
First, initialize your sweep with the Next, pass an integer value to the count flag to set the maximum number of runs to try.
wandb sweep command. For more information, see Initialize sweeps.