Skip to content

Commit

Permalink
fixed time and word per sec reported in validation step (#1338)
Browse files Browse the repository at this point in the history
  • Loading branch information
YovaKem authored and neubig committed Apr 4, 2018
1 parent 20fd674 commit 348ca39
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/rnnlm/lstmlm-auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ def minibatch_lm_loss(self, sents):
loss_exp, mb_words = lm.minibatch_lm_loss(valid_minibatch)
dev_loss += loss_exp.scalar_value()
dev_words += mb_words
dev_time = time.time() - dev_start
print("nll=%.4f, ppl=%.4f, words=%r, time=%.4f, word_per_sec=%.4f" % (
dev_loss / dev_words, math.exp(dev_loss / dev_words), dev_words,
train_time, all_words / train_time))
dev_time, dev_words / dev_time))

# Compute loss for one training minibatch.
minibatch = [next(random_training_instance)
Expand All @@ -124,4 +125,3 @@ def minibatch_lm_loss(self, sents):
if cur_epoch != epoch:
print("epoch %r finished" % cur_epoch)
epoch = cur_epoch

0 comments on commit 348ca39

Please sign in to comment.