MCPcopy Create free account
hub / github.com/adobe-research/custom-diffusion / str2bool

Function str2bool

train.py:118–126  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

116
117def get_parser(**parser_kwargs):
118 def str2bool(v):
119 if isinstance(v, bool):
120 return v
121 if v.lower() in ("yes", "true", "t", "y", "1"):
122 return True
123 elif v.lower() in ("no", "false", "f", "n", "0"):
124 return False
125 else:
126 raise argparse.ArgumentTypeError("Boolean value expected.")
127
128 parser = argparse.ArgumentParser(**parser_kwargs)
129 parser.add_argument(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected