Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix last step is not executed #236

Merged
merged 4 commits into from
Oct 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions dlio_benchmark/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ def _train(self, epoch):
loader = self.framework.get_loader(dataset_type=DatasetType.TRAIN)
t0 = time()
for batch in dlp.iter(loader.next()):
if overall_step > max_steps or overall_step > self.total_training_steps:
if self.args.my_rank == 0:
logging.info(f"{utcnow()} Maximum number of steps reached")
if (block_step != 1 and self.do_checkpoint) or (not self.do_checkpoint):
self.stats.end_block(epoch, block, block_step - 1)
break
self.stats.batch_loaded(epoch, overall_step, block, t0)
# Log a new block, unless it's the first one which we've already logged before the loop
if block_step == 1 and block != 1:
Expand All @@ -283,13 +289,6 @@ def _train(self, epoch):
self.next_checkpoint_step += self.steps_between_checkpoints
else:
block_step += 1

if overall_step >= max_steps or overall_step == self.total_training_steps:
if self.args.my_rank == 0:
logging.info(f"{utcnow()} Maximum number of steps reached")
if (block_step != 1 and self.do_checkpoint) or (not self.do_checkpoint):
self.stats.end_block(epoch, block, block_step - 1)
break
overall_step += 1
t0 = time()
self.comm.barrier()
Expand Down
Loading