question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow for optional boolean flags in sweeps

See original GitHub issue

Problem or Use Case I’m using a yaml-based sweep config to run a script that uses ArgumentParser. Since ArgumentParser doesn’t accept bool values, one of the workarounds is to do the following:

parser.add_argument('--foo', dest='foo', action='store_true')
parser.set_defaults(foo=False)

In this scenario the foo will be False, unless --foo is provided. One could also add a --no-foo flag to make both options explicit.

I don’t see a way for wandb to sweep optional flags like this. My workaround is to make the arg a string like parser.add_argument('--foo', type=str, default='false'), give the sweep [true, false] categorical options, and later convert the value like so: args.foo = args.foo in {'True', 'true'}. But this is hacky; I don’t want to change my arg structure for external tools like wandb, and it’s easy to forget the conversion when adding new args.

Suggested Solution A way to configure optional flag configurations for sweeps, where the flag is either present or not

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:27
  • Comments:38 (2 by maintainers)

github_iconTop GitHub Comments

19reactions
ntudycommented, Jul 11, 2021

We can add boolean flags under command https://docs.wandb.ai/guides/sweeps/configuration#command

20210711212249

7reactions
cvphelpscommented, Jan 19, 2021

Hi Evan, thanks for the good suggestion. We will be returning to Sweeps to start a new batch of improvements next quarter, and I’ll include your feedback in that process.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow for optional boolean flags in sweeps #1700 - GitHub
Problem or Use Case I'm using a yaml-based sweep config to run a script that uses ArgumentParser. Since ArgumentParser doesn't accept bool ......
Read more >
Argparse optional boolean - python - Stack Overflow
For --foo False that means bool("False") , producing True ; all non-empty strings are true! See Why is argparse not parsing my boolean...
Read more >
Sweep - TFlex
Sweep operation allows creating a solid body by sweeping a contour along a spatial path ... Select the target body for the Boolean...
Read more >
2.12 Environment Control (Prolog flags)
A boolean Prolog flag is true iff the Prolog flag is present and the Value is the atom true . Tests for such...
Read more >
FAQ - Documentation - Weights & Biases - Wandb
For runs that are not part of a sweep, the values of wandb.config are ... in the command section of the config to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found