Skip to content

Commit

Permalink
[Fix] Fix the resume of iteration (#1471)
Browse files Browse the repository at this point in the history
  • Loading branch information
LZHgrla committed Jan 11, 2024
1 parent 4a50213 commit b51bf60
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mmengine/runner/loops.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,14 @@ def run(self) -> None:
# In iteration-based training loop, we treat the whole training process
# as a big epoch and execute the corresponding hook.
self.runner.call_hook('before_train_epoch')
if self._iter > 0:
print_log(
f'Advance dataloader {self._iter} steps to skip data '
'that has already been trained',
logger='current',
level=logging.WARNING)
for _ in range(self._iter):
next(self.dataloader_iterator)
while self._iter < self._max_iters and not self.stop_training:
self.runner.model.train()

Expand Down

0 comments on commit b51bf60

Please sign in to comment.