MCPcopy Create free account
hub / github.com/baidu/DDParser / build_conf

Method build_conf

ddparser/parser/config.py:145–158  ·  view source on GitHub ↗

Initialize the parameters, then combine the parameters parsed by the parser and the parameters read by config

(self, parser, args=None)

Source from the content-addressed store, hash-verified

143 self.build_conf(parser, args)
144
145 def build_conf(self, parser, args=None):
146 """Initialize the parameters, then combine the parameters parsed by the parser and the parameters read by config"""
147 args = parser.parse_args(args)
148 self.read(args.config_path)
149 self.namespace = argparse.Namespace()
150 self.update(
151 dict((name, ast.literal_eval(value)) for section in self.sections() for name, value in self.items(section)))
152 args.nranks = paddle.distributed.get_world_size()
153 args.local_rank = paddle.distributed.get_rank()
154 args.fields_path = os.path.join(args.model_files, "fields")
155 args.model_path = os.path.join(args.model_files, "model")
156 # update config from args
157 self.update(vars(args))
158 return self
159
160 def __repr__(self):
161 """repr"""

Callers 1

__init__Method · 0.95

Calls 1

updateMethod · 0.95

Tested by

no test coverage detected