sweeps

raw JSON →
0.2.0 verified Fri May 01 auth: no python

Weights and Biases Hyperparameter Sweeps Engine. Current version 0.2.0. Release cadence is irregular; last release was v0.2.0.

pip install sweeps
error ModuleNotFoundError: No module named 'sweeps'
cause The `sweeps` library is not installed.
fix
Run pip install sweeps to install the package.
error wandb: ERROR Error while calling wandb sweep function: ...
cause The training function defined for the sweep agent may have an error, or required packages are missing.
fix
Check the training function for bugs and ensure all dependencies (e.g., scikit-learn) are installed.
gotcha The `sweeps` library is a standalone engine but sweep execution still requires `wandb` to start the agent. Do not attempt to run sweeps without `wandb` installed.
fix Ensure `wandb` is installed: `pip install wandb`
deprecated Sweep methods `bayes` and `grid` may not be fully supported in future versions. Prefer `random` or custom search.
fix Use `method: 'random'` in sweep configuration.

Initialize a W&B sweep with sweeps config, define training function, launch agent.

import wandb
import sweeps

sweep_config = {
    'method': 'random',
    'parameters': {
        'learning_rate': {'min': 0.001, 'max': 0.1},
        'batch_size': {'values': [16, 32, 64]}
    }
}

sweep_id = wandb.sweep(sweep_config, project='my-sweep')
def train():
    run = wandb.init()
    lr = wandb.config.learning_rate
    bs = wandb.config.batch_size
    # ... training code ...
    wandb.log({'accuracy': 0.9})

wandb.agent(sweep_id, function=train, count=5)