From 39faa0a419a8051837ee26c433c8ba863a2b51f3 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Wed, 23 Oct 2019 20:15:03 -0700 Subject: [PATCH] Reset both WPS and UPS on first minibatch (#891) Summary: Makes more sense to reset either both meters or neither of them. Pull Request resolved: https://github.com/fairinternal/fairseq-py/pull/891 Differential Revision: D18109027 Pulled By: jma127 fbshipit-source-id: f63baed9a6b928a6f591a76e69ef6e9c524e4398 --- train.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/train.py b/train.py index 9396358aa9..d287e2513d 100644 --- a/train.py +++ b/train.py @@ -146,9 +146,10 @@ def train(args, trainer, task, epoch_itr): stats[k] = extra_meters[k].avg progress.log(stats, tag='train', step=stats['num_updates']) - # ignore the first mini-batch in words-per-second calculation + # ignore the first mini-batch in words-per-second and updates-per-second calculation if i == 0: trainer.get_meter('wps').reset() + trainer.get_meter('ups').reset() num_updates = trainer.get_num_updates() if (