MCPcopy Create free account
hub / github.com/LuChengTHU/dpm-solver / get_parser

Function get_parser

examples/stable-diffusion/main.py:24–123  ·  view source on GitHub ↗
(**parser_kwargs)

Source from the content-addressed store, hash-verified

22
23
24def get_parser(**parser_kwargs):
25 def str2bool(v):
26 if isinstance(v, bool):
27 return v
28 if v.lower() in ("yes", "true", "t", "y", "1"):
29 return True
30 elif v.lower() in ("no", "false", "f", "n", "0"):
31 return False
32 else:
33 raise argparse.ArgumentTypeError("Boolean value expected.")
34
35 parser = argparse.ArgumentParser(**parser_kwargs)
36 parser.add_argument(
37 "-n",
38 "--name",
39 type=str,
40 const=True,
41 default="",
42 nargs="?",
43 help="postfix for logdir",
44 )
45 parser.add_argument(
46 "-r",
47 "--resume",
48 type=str,
49 const=True,
50 default="",
51 nargs="?",
52 help="resume from logdir or checkpoint in logdir",
53 )
54 parser.add_argument(
55 "-b",
56 "--base",
57 nargs="*",
58 metavar="base_config.yaml",
59 help="paths to base configs. Loaded from left-to-right. "
60 "Parameters can be overwritten or added with command-line options of the form `--key value`.",
61 default=list(),
62 )
63 parser.add_argument(
64 "-t",
65 "--train",
66 type=str2bool,
67 const=True,
68 default=False,
69 nargs="?",
70 help="train",
71 )
72 parser.add_argument(
73 "--no-test",
74 type=str2bool,
75 const=True,
76 default=False,
77 nargs="?",
78 help="disable test",
79 )
80 parser.add_argument(
81 "-p",

Callers 1

main.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected