Skip to content

Commit 5e499c6

Browse files
committed
[ELECTRA/TF2] fix squad perf calculation
1 parent 8909d58 commit 5e499c6

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

TensorFlow2/LanguageModeling/ELECTRA/run_tf_squad.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@ def main():
502502
# Optimize the model
503503
loss_value = train_step(model, inputs, loss, USE_AMP, opt, (iter == 0 and epoch == 0),
504504
v2=args.version_2_with_negative, loss_class=loss_class, fp16=USE_AMP)
505+
#introduce CPU-GPU sync for training perf computation
506+
loss_numpy = loss_value.numpy()
507+
505508
epoch_perf_avg.update_state(1. * BATCH_SIZE / (time.time() - iter_start))
506509
if iter % args.log_freq == 0:
507510
if is_main_process():

0 commit comments

Comments
 (0)