MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / parse_bool

Function parse_bool

scripts/convert_original_controlnet_to_diffusers.py:80–86  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

78
79 # small workaround to get argparser to parse a boolean input as either true _or_ false
80 def parse_bool(string):
81 if string == "True":
82 return True
83 elif string == "False":
84 return False
85 else:
86 raise ValueError(f"could not parse string as bool {string}")
87
88 parser.add_argument(
89 "--use_linear_projection", help="Override for use linear projection", required=False, type=parse_bool

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected