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
04cd82bd
You need to sign in or sign up before continuing.
Commit
04cd82bd
authored
Sep 03, 2020
by
mohammad
Browse files
debuged the cpu init for mp=1
parent
42d2be06
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
8 deletions
+1
-8
megatron/mpu/layers.py
megatron/mpu/layers.py
+1
-8
No files found.
megatron/mpu/layers.py
View file @
04cd82bd
...
@@ -72,14 +72,6 @@ def _initialize_affine_weight_cpu(weight, output_size, input_size,
...
@@ -72,14 +72,6 @@ def _initialize_affine_weight_cpu(weight, output_size, input_size,
weight
.
partition_dim
=
partition_dim
weight
.
partition_dim
=
partition_dim
weight
.
partition_stride
=
stride
weight
.
partition_stride
=
stride
# If we only use 1 process for model parallelism, bypass scatter.
world_size
=
get_model_parallel_world_size
()
if
world_size
==
1
:
init_method
(
weight
)
if
return_master_weight
:
return
weight
return
None
# Initialize master weight
# Initialize master weight
master_weight
=
torch
.
empty
(
output_size
,
input_size
,
master_weight
=
torch
.
empty
(
output_size
,
input_size
,
dtype
=
torch
.
float
,
dtype
=
torch
.
float
,
...
@@ -93,6 +85,7 @@ def _initialize_affine_weight_cpu(weight, output_size, input_size,
...
@@ -93,6 +85,7 @@ def _initialize_affine_weight_cpu(weight, output_size, input_size,
weight_list
=
torch
.
split
(
master_weight
,
per_partition_per_stride_size
,
weight_list
=
torch
.
split
(
master_weight
,
per_partition_per_stride_size
,
dim
=
partition_dim
)
dim
=
partition_dim
)
rank
=
get_model_parallel_rank
()
rank
=
get_model_parallel_rank
()
world_size
=
get_model_parallel_world_size
()
my_weight_list
=
weight_list
[
rank
::
world_size
]
my_weight_list
=
weight_list
[
rank
::
world_size
]
with
torch
.
no_grad
():
with
torch
.
no_grad
():
...
...
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