✨ Use store_true for bool args (#1822)

* ✨ Use store_true for bool args

* debug

Co-authored-by: Nate Raw <nxr9266@g.rit.edu>
This commit is contained in:
William FalconandNate Raw authored and GitHub committed 2020-05-13 19:12:06 -04:00
1 parent e961f7e344
commit 648d516668
2 files changed
+11 -1

No files matched your search

+10
View File
@@ -667,6 +667,16 @@ class Trainer(
def allowed_type(x):
return bool(parsing.strtobool(x))
# Bool args with default of True parsed as flags not key value pair
if arg_types == (bool,) and arg_default is False:
parser.add_argument(
f'--{arg}',
action='store_true',
dest=arg,
help='autogenerated by pl.Trainer'
)
continue
if arg == 'gpus':
allowed_type = Trainer.allowed_type
arg_default = Trainer.arg_default
+1 -1
View File
@@ -30,7 +30,7 @@ def test_default_args(tmpdir):
@pytest.mark.parametrize('cli_args', [
['--accumulate_grad_batches=22'],
['--print_nan_grads=1', '--weights_save_path=./'],
['--print_nan_grads', '--weights_save_path=./'],
[]
])
def test_add_argparse_args_redefined(cli_args):