Skip to content

Commit 8bb7c5a

Browse files
bmccannsoumith
authored andcommitted
off by one in printing batch number
1 parent 0e77a0b commit 8bb7c5a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

OpenNMT/train.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ def trainEpoch(epoch):
186186
# shuffle mini batch order
187187
batchOrder = torch.randperm(len(trainData))
188188

189-
total_loss, total_words, total_num_correct = 0
190-
report_loss, report_tgt_words, report_src_words, report_num_correct = 0
189+
total_loss, total_words, total_num_correct = 0, 0, 0
190+
report_loss, report_tgt_words, report_src_words, report_num_correct = 0, 0, 0, 0
191191
start = time.time()
192192
for i in range(len(trainData)):
193193

@@ -215,7 +215,7 @@ def trainEpoch(epoch):
215215
total_words += num_words
216216
if i % opt.log_interval == -1 % opt.log_interval:
217217
print("Epoch %2d, %5d/%5d; acc: %6.2f; ppl: %6.2f; %3.0f src tok/s; %3.0f tgt tok/s; %6.0f s elapsed" %
218-
(epoch, i, len(trainData),
218+
(epoch, i+1, len(trainData),
219219
report_num_correct / report_tgt_words * 100,
220220
math.exp(report_loss / report_tgt_words),
221221
report_src_words/(time.time()-start),

0 commit comments

Comments
 (0)