I am trying to use the sweeps for doing hyperparameter search. I have a problem that is that my main function receives two arguments: config and data. Therefore, my call should be something like: wandb.agent(sweep_id, function=train_hparams_sweep(data), count=10). But in that case, wandb.config is empty. While if I call wandb.agent(sweep_id, function=train_hparams_sweep, count=10), if returns error cause there’s an argument missing.
Iff your data is consistent, I would advise grabbing your data from within the function itself and letting wandb.config store your config values.
import wandb
wandb.login()
def main():
wandb.init(project='my-first-sweep')
# Import data here and do training here
# If you want to grab x from the config, write in `config['x']`
wandb.log({'score': score})
sweep_configuration = {
# Your sweep configuration over two hyper parameters, x and y
}
sweep_id = wandb.sweep(
sweep=sweep_configuration,
project='my-first-sweep'
)
wandb.agent(sweep_id, function=main, count=10)