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

Trainer.add_argparse_args bool type #1570

Closed
fschlatt opened this issue Apr 23, 2020 · 1 comment · Fixed by #1571
Closed

Trainer.add_argparse_args bool type #1570

fschlatt opened this issue Apr 23, 2020 · 1 comment · Fixed by #1571
Labels
bug Something isn't working help wanted Open to be worked on

Comments

@fschlatt
Copy link
Contributor

🐛 Bug

The boolean arguments added using Trainer.add_argparse_args always evaluate to True. This is caused by the following lines of the add_argparse_args fucntion:

if isinstance(allowed_type, bool):
    def allowed_type(x):
         return bool(distutils.util.strtobool(x))

Because allowed_type is the actual data type and not an instance of bool. isinstance(bool, bool) is equal to False. bool is bool is equal True

@fschlatt fschlatt added bug Something isn't working help wanted Open to be worked on labels Apr 23, 2020
fschlatt added a commit to fschlatt/pytorch-lightning that referenced this issue Apr 23, 2020
@fschlatt fschlatt mentioned this issue Apr 23, 2020
4 tasks
@fschlatt
Copy link
Contributor Author

I just found the Trainer.add_argparse_args clashes with the auto_lr_find argument as auto_lr_find can be either bool or str. I would propose removing the option to provide a string to auto_lr_find. If I understand correctly then the str option is only there to specify a separate learning rate using argparse anyway. On top of being confusing you could just use hparams.lr and set auto_lr_find to False which is more straightforward

williamFalcon pushed a commit that referenced this issue Apr 23, 2020
* fix boolean argparse #1570

* update change log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Open to be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant