Limiting the number of runs for a sweep of method 'bayes'


Is there a way to limit in advance the number of configs a sweep is going to use?
Currently, I need to follow the progress and stop the sweep manually.

Moreover, if there is such a setting, could it also be configured dynamically on-the-fly?


wandb agent has a parameter count with which you can set the number of trials to run.

You can use wandb python agent to dynamically set it.

Thank you, but I was asking if the sweep has a count (for instance if I have several agents and don’t know in advance which agent will finish first)

Hi @tomjur, there isn’t really a way to set this explicitly. As @udaylunawat pointed out you could make the sum of the agent counts equal the number of runs you would like but this wouldn’t allow you to dynamically change this as you mentioned.

Probably the closest thing you could do is access the sweep via the API and introduce some logic to shut the sweep if it reaches the number of runs you are looking for. For example:

import wandb
import os
api = wandb.Api()
sweep = api.sweep(path/to/sweep)
if len(sweep.runs) >=  max_runs:
    command = f'wandb sweep --stop {sweep_id}'

Thanks, that could work for now.
It would be great if the web UI \ config were able to control this behaviour.


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.