awslabs / Renate

Library for automatic retraining and continual learning
https://renate.readthedocs.io
Apache License 2.0
279 stars 7 forks source link

Passing of booleans in the config file #235

Open alexanderbuchholz opened 1 year ago

alexanderbuchholz commented 1 year ago

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 commented 1 year ago

I assume you did not properly setup the parsing logic for this parameter. Check early_stopping for an example: https://github.com/awslabs/Renate/blob/aeae35c8d4962051f29b9d640f68c2ce5dcd1404/src/renate/cli/parsing_functions.py#L289-L297

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.