MCPcopy Create free account
hub / github.com/WuTao-CS/CustomCrafter / get_parser

Function get_parser

custom.py:73–292  ·  view source on GitHub ↗
(**parser_kwargs)

Source from the content-addressed store, hash-verified

71 del sd
72 return model
73def get_parser(**parser_kwargs):
74 def str2bool(v):
75 if isinstance(v, bool):
76 return v
77 if v.lower() in ("yes", "true", "t", "y", "1"):
78 return True
79 elif v.lower() in ("no", "false", "f", "n", "0"):
80 return False
81 else:
82 raise argparse.ArgumentTypeError("Boolean value expected.")
83
84 parser = argparse.ArgumentParser(**parser_kwargs)
85 parser.add_argument(
86 "-n",
87 "--name",
88 type=str,
89 const=True,
90 default="",
91 nargs="?",
92 help="postfix for logdir",
93 )
94 parser.add_argument(
95 "-r",
96 "--resume",
97 type=str,
98 const=True,
99 default="",
100 nargs="?",
101 help="resume from logdir or checkpoint in logdir",
102 )
103 parser.add_argument(
104 "-b",
105 "--base",
106 nargs="*",
107 metavar="base_config.yaml",
108 help="paths to base configs. Loaded from left-to-right. "
109 "Parameters can be overwritten or added with command-line options of the form `--key value`.",
110 default=list(),
111 )
112 parser.add_argument(
113 "-t",
114 "--train",
115 type=str2bool,
116 const=True,
117 default=False,
118 nargs="?",
119 help="train",
120 )
121 parser.add_argument(
122 "--no-test",
123 type=str2bool,
124 const=True,
125 default=True,
126 nargs="?",
127 help="disable test",
128 )
129 parser.add_argument(
130 "--with_prior_preservation",

Callers 1

custom.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected