def get_config(args): # get commands from command line override_args = _parser.argv_to_vars(sys.argv) # load yaml file yaml_txt = open(args.config).read() # override args loaded_yaml = yaml.load(yaml_txt, Loader=yaml.FullLoader) for v in override_args: loaded_yaml[v] = getattr(args, v) print(f"=> Reading YAML config from {args.config}") args.__dict__.update(loaded_yaml)
parser.add_argument( "--bn_type", type=str, default="LearnedBatchNorm", help="BN type of conv layer. Optional: NonAffineBatchNorm" ) parser.add_argument( '--debug', action='store_true', help='input to open debug state') args = parser.parse_args() override_args = _parser.argv_to_vars(sys.argv) # load yaml file yaml_txt = open(args.config).read() # override args loaded_yaml = yaml.load(yaml_txt, Loader=yaml.FullLoader) #print(loaded_yaml) for v in override_args: loaded_yaml[v] = getattr(args, v) print(f"==> Reading YAML config from {args.config}") args.__dict__.update(loaded_yaml)