Commit 39faa0a4 authored by Jerry Ma's avatar Jerry Ma Committed by Facebook Github Bot
Browse files

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
parent 5a2f76ed
...@@ -146,9 +146,10 @@ def train(args, trainer, task, epoch_itr): ...@@ -146,9 +146,10 @@ def train(args, trainer, task, epoch_itr):
stats[k] = extra_meters[k].avg stats[k] = extra_meters[k].avg
progress.log(stats, tag='train', step=stats['num_updates']) 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: if i == 0:
trainer.get_meter('wps').reset() trainer.get_meter('wps').reset()
trainer.get_meter('ups').reset()
num_updates = trainer.get_num_updates() num_updates = trainer.get_num_updates()
if ( if (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment