Skip to content

Commit fac9d15

Browse files
galrotemfacebook-github-bot
authored andcommitted
fix epoch number in log (#868)
Summary: Pull Request resolved: #868 This would currently log "Completed N steps in train epoch 0" in the first epoch, and all epochs would be offset by 1. Reviewed By: anshulverma, JKSenthil Differential Revision: D59976202 fbshipit-source-id: 9ef12f3ec86db52d063788e881d9f9d3f1209b7e
1 parent 86b2598 commit fac9d15

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

torchtnt/framework/train.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,9 @@ def _train_epoch_impl(
258258
if not any_steps_completed:
259259
logger.warning("No steps completed during train epoch!")
260260
else:
261+
# increment epoch happens after we log, hence we add 1 to the epoch counter
261262
logger.info(
262-
f"Completed {train_unit.train_progress.num_steps_completed_in_epoch} steps in train epoch {train_unit.train_progress.num_epochs_completed}"
263+
f"Completed {train_unit.train_progress.num_steps_completed_in_epoch} steps in train epoch {train_unit.train_progress.num_epochs_completed + 1}"
263264
)
264265

265266
# set progress counters for the next epoch

0 commit comments

Comments
 (0)