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
3262398d
Commit
3262398d
authored
Apr 24, 2020
by
Raul Puri
Browse files
Merge branch 'args_fix' into 'master'
args bug fix See merge request ADLR/megatron-lm!77
parents
3af90c7a
04aa357e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
megatron/arguments.py
megatron/arguments.py
+13
-13
No files found.
megatron/arguments.py
View file @
3262398d
...
@@ -47,6 +47,19 @@ def parse_args(extra_args_provider=None, defaults={},
...
@@ -47,6 +47,19 @@ def parse_args(extra_args_provider=None, defaults={},
else
:
else
:
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
# Distributed args.
args
.
rank
=
int
(
os
.
getenv
(
'RANK'
,
'0'
))
args
.
world_size
=
int
(
os
.
getenv
(
"WORLD_SIZE"
,
'1'
))
args
.
model_parallel_size
=
min
(
args
.
model_parallel_size
,
args
.
world_size
)
if
args
.
rank
==
0
:
print
(
'using world size: {} and model-parallel size: {} '
.
format
(
args
.
world_size
,
args
.
model_parallel_size
))
# Fp16 loss scaling.
args
.
dynamic_loss_scale
=
False
if
args
.
loss_scale
is
None
:
args
.
dynamic_loss_scale
=
True
# Set input defaults.
# Set input defaults.
for
key
in
defaults
:
for
key
in
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
...
@@ -67,19 +80,6 @@ def parse_args(extra_args_provider=None, defaults={},
...
@@ -67,19 +80,6 @@ def parse_args(extra_args_provider=None, defaults={},
for
req_arg
in
required_args
:
for
req_arg
in
required_args
:
_check_arg_is_not_none
(
args
,
req_arg
)
_check_arg_is_not_none
(
args
,
req_arg
)
# Distributed args.
args
.
rank
=
int
(
os
.
getenv
(
'RANK'
,
'0'
))
args
.
world_size
=
int
(
os
.
getenv
(
"WORLD_SIZE"
,
'1'
))
args
.
model_parallel_size
=
min
(
args
.
model_parallel_size
,
args
.
world_size
)
if
args
.
rank
==
0
:
print
(
'using world size: {} and model-parallel size: {} '
.
format
(
args
.
world_size
,
args
.
model_parallel_size
))
# Fp16 loss scaling.
args
.
dynamic_loss_scale
=
False
if
args
.
loss_scale
is
None
:
args
.
dynamic_loss_scale
=
True
# Checks.
# Checks.
assert
args
.
hidden_size
%
args
.
num_attention_heads
==
0
assert
args
.
hidden_size
%
args
.
num_attention_heads
==
0
if
args
.
seq_length
is
not
None
:
if
args
.
seq_length
is
not
None
:
...
...
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