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
bba5f289
Unverified
Commit
bba5f289
authored
Jul 20, 2021
by
Rick Ho
Committed by
GitHub
Jul 20, 2021
Browse files
Merge pull request #64 from laekov/fp16_bal_loss
fix fp16 training with balance loss
parents
537679a8
ebefe2b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
fmoe/megatron/balance.py
fmoe/megatron/balance.py
+2
-2
No files found.
fmoe/megatron/balance.py
View file @
bba5f289
...
...
@@ -49,7 +49,7 @@ def generate_megatron_gate_hook(layer_idx, num_expert_global):
def
add_balance_log
(
model
,
writer
,
iteration
):
from
megatron
import
is_last_rank
if
hasattr
(
model
,
'module'
):
while
hasattr
(
model
,
'module'
):
model
=
model
.
module
balance_dict_tensor
=
torch
.
vstack
(
...
...
@@ -92,7 +92,7 @@ def patch_forward_step(forward_step_func):
return
output
loss_name
=
args
.
balance_strategy
+
"_loss"
if
hasattr
(
model
,
'module'
):
while
hasattr
(
model
,
'module'
):
model
=
model
.
module
loss_list
=
[
l
.
mlp
.
gate
.
get_loss
(
clear
=
False
).
view
(
1
)
...
...
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