proper boolean conversion
There is an issue that boolean variables parsed by argument parser are not indicated as boolean but as string. As consequence, these parameters are always True if provided. * [ ] Add boolean conversion to helpers to ensure boolean variable type.
def str2bool(v):
if isinstance(v, bool):
return v
elif isinstance(v, str):
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
return False
else:
raise argparse.ArgumentTypeError('Boolean value expected.')
else:
raise argparse.ArgumentTypeError('Boolean value expected.')
-
update start scripts
parser.add_argument('--batch_normalization', default=argparse.SUPPRESS, type=lambda s: str2bool(s))