MCPcopy Create free account
hub / github.com/IceClear/StableSR / get_parser

Function get_parser

main.py:26–125  ·  view source on GitHub ↗
(**parser_kwargs)

Source from the content-addressed store, hash-verified

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

Callers 1

main.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected