Skip to content

Commit bdd64fd

Browse files
bpopetersvince62s
authored andcommitted
re-add source word logging (#1213)
1 parent 6a8b4b1 commit bdd64fd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

onmt/trainer.py

+2
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ def _gradient_accumulation(self, true_batches, normalization, total_stats,
250250
trunc_size = target_size
251251

252252
src, src_lengths = inputters.make_features(batch, 'src')
253+
if src_lengths is not None:
254+
report_stats.n_src_words += src_lengths.sum().item()
253255

254256
# this method unsqueezes its input
255257
tgt_outer, _ = inputters.make_features(batch, 'tgt')

0 commit comments

Comments
 (0)