Local Controller

Run search and stopping algorithms locally, instead of using our cloud-hosted service

By default the hyper-parameter controller is hosted by W&B as a cloud service. W&B agents communicate with the controller to determine the next set of parameters to use for training. The controller is also responsible for running early stopping algorithms to determine which runs can be stopped.

The local controller feature allows the user to run search and stopping algorithms locally. The local controller gives the user the ability to inspect and instrument the code in order to debug issues as well as develop new features which can be incorporated into the cloud service.

This feature is offered to support faster development and debugging of new algorithms for the Sweeps tool. It is not intended for actual hyperparameter optimization workloads.

Running the local controller from the command line

The simplest method is to indicate you want to use the local controller when starting your sweep:

wandb sweep --controller sweep-config.yaml

Alternatively, you can get more control by initializing a sweep separately from starting the controller. You'll need to add the following to your sweep's configuration file:

type: local

Then, after initializing with wandb sweep, you can start a controller using wandb controller:

wandb sweep sweep-config.yaml
# wandb sweep command will print a sweep_id
wandb controller {user}/{entity}/{sweep_id}

Run a local controller inside Python

When developing and debugging your own parameter search algorithms, you might wish to run the sweep controller from Python.

The simplest way to run a controller:

sweep = wandb.controller(sweep_id)

If you want more control of the controller loop:

import wandb
sweep = wandb.controller(sweep_id)
while not sweep.done():

Or even more control over the parameters being served:

import wandb
sweep = wandb.controller(sweep_id)
while not sweep.done():
params = sweep.search()

If you want to specify your sweep entirely with code you can do something like this:

import wandb
sweep = wandb.controller()
sweep.configure_parameter("param1", value=3)