in quant/common/parser.py [0:0]
def parse_config(args: Namespace, validator: Callable[[Namespace], None] = _validate_args) -> dict:
"""
Parse config file and override with CLI args.
Args:
args: parsed argparse CLI args
validator: validator for config
Returns:
A resolved config, applying CLI args on top of the config file
"""
validator(args)
config = {}
if args.restore_experiment:
with open(Path(args.restore_experiment) / 'config.yaml') as f:
config = yaml.safe_load(f)
if args.config:
with open(args.config) as f:
config = yaml.safe_load(f)
config['config'] = args.config
parse_common_fields(args, config)
if args.restore_experiment:
config['restore_experiment'] = args.restore_experiment
return config