Documentation
Search…
wandb.agent
Generic agent entrypoint, used for CLI or jupyter.
agent(
sweep_id, function=None, entity=None, project=None, count=None
)
Will run a function or program with configuration parameters specified by server.
Arguments
Text
sweep_id
(dict) Sweep ID generated by CLI or sweep API
function
(func, optional) A function to call instead of the "program" specifed in the config.
entity
(str, optional) W&B Entity
project
(str, optional) W&B Project
count
(int, optional) the number of trials to run.

Examples:

Run a sample sweep over a function:
import wandb
sweep_configuration = {
"name": "my-awesome-sweep",
"metric": {"name": "accuracy", "goal": "maximize"},
"method": "grid",
"parameters": {
"a": {
"values": [1, 2, 3, 4]
}
}
}
def my_train_func():
# read the current value of parameter "a" from wandb.config
wandb.init()
a = wandb.config.a
wandb.log({"a": a, "accuracy": a + 1})
sweep_id = wandb.sweep(sweep_configuration)
# run the sweep
wandb.agent(sweep_id, function=my_train_func)
Copy link