Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Megatron-LM
Commits
d28527d5
Commit
d28527d5
authored
Apr 24, 2020
by
Raul Puri
Browse files
changed default override behavior
parent
ef5b2f06
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
megatron/arguments.py
megatron/arguments.py
+6
-3
No files found.
megatron/arguments.py
View file @
d28527d5
...
@@ -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'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment