MCPcopy Index your code
hub / github.com/huggingface/diffusers / str2bool

Function str2bool

scripts/convert_consistency_to_diffusers.py:109–120  ·  view source on GitHub ↗

https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse

(v)

Source from the content-addressed store, hash-verified

107
108
109def str2bool(v):
110 """
111 https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse
112 """
113 if isinstance(v, bool):
114 return v
115 if v.lower() in ("yes", "true", "t", "y", "1"):
116 return True
117 elif v.lower() in ("no", "false", "f", "n", "0"):
118 return False
119 else:
120 raise argparse.ArgumentTypeError("boolean value expected")
121
122
123def convert_resnet(checkpoint, new_checkpoint, old_prefix, new_prefix, has_skip=False):

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…