Commit d28527d5 authored by Raul Puri's avatar Raul Puri
Browse files

changed default override behavior

parent ef5b2f06
...@@ -52,9 +52,12 @@ def parse_args(extra_args_provider=None, defaults={}, ...@@ -52,9 +52,12 @@ def parse_args(extra_args_provider=None, defaults={},
# For default to be valid, it should not be provided in the # For default to be valid, it should not be provided in the
# arguments that are passed to the program. We check this by # arguments that are passed to the program. We check this by
# ensuring the arg is set to None. # ensuring the arg is set to None.
assert getattr(args, key) is None, \ if getattr(args, key) is not None:
'defaults can only be overwritten for args with None values.' print('WARNING: overriding default arguments for {key}:{v} with \
setattr(args, key, defaults[key]) {key}:{v2}'.format(key=key, v=defaults[key],
v2=getattr(args, key))
else:
setattr(args, key, defaults[key])
# Check required arguments. # Check required arguments.
required_args = ['num_layers', 'hidden_size', 'num_attention_heads', required_args = ['num_layers', 'hidden_size', 'num_attention_heads',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment