Skip to content

Commit 74d2dfd

Browse files
committed
Fix the perplexity value
1 parent 235225e commit 74d2dfd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

aocr/model/model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ def train(self):
345345
step_time, loss = 0.0, 0.0
346346

347347
# Print statistics for the previous epoch.
348+
perplexity = math.exp(loss) if loss < 300 else float('inf')
348349
logging.info("Global step %d. Time: %.3f, loss: %f, perplexity: %.2f."
349350
% (self.sess.run(self.global_step), step_time, loss, perplexity))
350351
# Save checkpoint and reset timer and loss.

0 commit comments

Comments
 (0)