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
913d7127
Commit
913d7127
authored
Jun 17, 2021
by
Rick Ho
Browse files
use cat instead of creating new tensor
parent
295a615a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
6 deletions
+1
-6
fmoe/megatron/balance.py
fmoe/megatron/balance.py
+1
-6
No files found.
fmoe/megatron/balance.py
View file @
913d7127
...
...
@@ -97,12 +97,7 @@ def patch_forward_step(forward_step_func):
loss_list
=
[
l
.
mlp
.
gate
.
get_loss
(
clear
=
False
)
for
l
in
model
.
language_model
.
transformer
.
layers
]
(
loss
,
state_dict
),
bal_loss
=
(
output
,
(
torch
.
tensor
(
loss_list
,
device
=
loss_list
[
0
].
device
).
mean
()
*
args
.
balance_loss_weight
).
float
(),
torch
.
cat
(
loss_list
).
mean
()
*
args
.
balance_loss_weight
)
# avarage across world group
...
...
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