Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing of booleans in the config file #235

Open
alexanderbuchholz opened this issue May 16, 2023 · 1 comment
Open

Passing of booleans in the config file #235

alexanderbuchholz opened this issue May 16, 2023 · 1 comment
Labels

Comments

@alexanderbuchholz
Copy link

I tried to pass a boolean via the config file, i.e.,

config = {..., "disable_grad_weight": False, ... }
execute_experiment_job(..., config_space = config, ....)

However the value gets set to True when arriving at the learner. Is this a know bug?
I could work around this by passing an int (and modifying the argument's type accordingly).

@wistuba
Copy link
Contributor

wistuba commented May 16, 2023

I assume you did not properly setup the parsing logic for this parameter. Check early_stopping for an example:

"early_stopping": {
"type": str,
"default": str(defaults.EARLY_STOPPING),
"choices": ["True", "False"],
"help": "Enables the early stopping of the optimization. Default: "
f"{defaults.EARLY_STOPPING}.",
"argument_group": OPTIONAL_ARGS_GROUP,
"true_type": bool,
},

The important part here is that type is str even though you are using a bool and the true_type is bool. That way, your boolean will be converted to a string, passed as a command line argument and converted back to a boolean. Right now, it is probably always True since every non-empty string is True.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants