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
FastMoE
Commits
092c8d67
Commit
092c8d67
authored
Feb 22, 2021
by
Sengxian
Browse files
fix unpack bug
parent
05728524
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
tests/test_numerical.py
tests/test_numerical.py
+4
-4
No files found.
tests/test_numerical.py
View file @
092c8d67
...
@@ -52,9 +52,9 @@ def _assert_numercial(names, moe_out_list, raw_out_list, rank):
...
@@ -52,9 +52,9 @@ def _assert_numercial(names, moe_out_list, raw_out_list, rank):
err
=
(
mo
-
ro
).
abs
().
sum
()
err
=
(
mo
-
ro
).
abs
().
sum
()
print
(
"Rank {} {} abs err {}"
.
format
(
rank
,
name
,
err
))
print
(
"Rank {} {} abs err {}"
.
format
(
rank
,
name
,
err
))
if
err
>
1e-3
:
if
err
>
1e-3
:
sys
.
stderr
.
write
(
"=========== moe out ==============
\n
"
)
sys
.
stderr
.
write
(
f
"===========
{
name
}
moe out ==============
\n
"
)
sys
.
stderr
.
write
(
"{}
\n
"
.
format
(
mo
))
sys
.
stderr
.
write
(
"{}
\n
"
.
format
(
mo
))
sys
.
stderr
.
write
(
"=========== raw out ==============
\n
"
)
sys
.
stderr
.
write
(
f
"===========
{
name
}
raw out ==============
\n
"
)
sys
.
stderr
.
write
(
"{}
\n
"
.
format
(
ro
))
sys
.
stderr
.
write
(
"{}
\n
"
.
format
(
ro
))
assert
False
assert
False
...
@@ -149,7 +149,7 @@ def test_fmoe_linear(
...
@@ -149,7 +149,7 @@ def test_fmoe_linear(
raw_out_list
=
raw_out
,
raw_grad_in
,
moe_raw
.
weight_htoh4
.
grad
,
moe_raw
.
weight_h4toh
.
grad
,
moe_raw
.
bias_htoh4
.
grad
,
moe_raw
.
bias_h4toh
.
grad
raw_out_list
=
raw_out
,
raw_grad_in
,
moe_raw
.
weight_htoh4
.
grad
,
moe_raw
.
weight_h4toh
.
grad
,
moe_raw
.
bias_htoh4
.
grad
,
moe_raw
.
bias_h4toh
.
grad
if
world_size
>
1
:
if
world_size
>
1
:
_
,
htoh4_w_grad
,
h4toh_w_grad
,
htoh4_b_grad
,
h4toh_b_grad
=
raw_out_list
_
,
__
,
htoh4_w_grad
,
h4toh_w_grad
,
htoh4_b_grad
,
h4toh_b_grad
=
raw_out_list
torch
.
distributed
.
all_reduce
(
htoh4_w_grad
)
torch
.
distributed
.
all_reduce
(
htoh4_w_grad
)
torch
.
distributed
.
all_reduce
(
h4toh_w_grad
)
torch
.
distributed
.
all_reduce
(
h4toh_w_grad
)
torch
.
distributed
.
all_reduce
(
htoh4_b_grad
)
torch
.
distributed
.
all_reduce
(
htoh4_b_grad
)
...
@@ -167,7 +167,7 @@ def test_fmoe_linear(
...
@@ -167,7 +167,7 @@ def test_fmoe_linear(
h4toh_b_grad
=
(
h4toh_b_grad
=
(
h4toh_b_grad
[
rank
*
num_expert
:
(
rank
+
1
)
*
num_expert
]
/
mp_size
h4toh_b_grad
[
rank
*
num_expert
:
(
rank
+
1
)
*
num_expert
]
/
mp_size
)
)
raw_out_list
=
_
,
htoh4_w_grad
,
h4toh_w_grad
,
htoh4_b_grad
,
h4toh_b_grad
raw_out_list
=
_
,
__
,
htoh4_w_grad
,
h4toh_w_grad
,
htoh4_b_grad
,
h4toh_b_grad
names
=
[
"output"
,
"input grad"
,
"htoh4 weight grad"
,
"h4toh weight grad"
,
"htoh4 bias grad"
,
"h4toh bias grad"
]
names
=
[
"output"
,
"input grad"
,
"htoh4 weight grad"
,
"h4toh weight grad"
,
"htoh4 bias grad"
,
"h4toh bias 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