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
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:
def train():
with wandb.init() as run:
print("config:", dict(run.config))
for epoch in range(35):
print("running", epoch)
wandb.log({"metric": run.config.param1, "epoch": epoch})
time.sleep(1)
wandb.agent(sweep_id, function=train)
Last updated
Was this helpful?