Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnXuan committed Oct 7, 2020
1 parent 539750e commit 0f617c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions LanguageModeling/BERT/pretrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ def PreTrain(
initializer_range=initializer_range,
)
with flow.scope.namespace("cls-loss"):
if use_fp16:
lm_loss = flow.reduce_mean(lm_loss)
ns_loss = flow.reduce_mean(ns_loss)
if not use_fp16:
lm_loss = flow.math.reduce_mean(lm_loss)
ns_loss = flow.math.reduce_mean(ns_loss)
total_loss = lm_loss + ns_loss
return total_loss, lm_loss, ns_loss

Expand Down

0 comments on commit 0f617c2

Please sign in to comment.