cn = CfgNode.load_yaml_with_base(args.cfg)
for k,v in cn.items():
if hasattr(args, k):
setattr(args, k, v)
else:
print("Warning: key %s not in args" %k)
args = parser.parse_args(namespace=args)
After Change
for k,v in cn.items():
if not hasattr(args, k):
print("Warning: key %s not in args" %k)
setattr(args, k, v)
args = parser.parse_args(namespace=args)
// Check if args are valid
assert args.rnn_size > 0, "rnn_size should be greater than 0"