Skip to content

Commit

Permalink
Change iteration timestamp for old checkpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
b-chu committed Aug 20, 2024
1 parent 4a5dfc1 commit 3dd2e0a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions composer/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,18 @@ def __init__(
auto_microbatching,
)

# Set the iteration timestamp to the overall timestamp if loading from a checkpoint that was created before
# iteration was introduced in Composer v0.19.1. This is necessary to ensure that the iteration timestamp is
# accurate for callbacks and backwards compatibility for checkpoints.
if (
self.state.timestamp.iteration == 0 and self.state.timestamp.token_in_iteration == 0 and
self.state.timestamp.epoch_in_iteration == 0
):
self.state.timestamp = self.state.timestamp.copy(
epoch_in_iteration=self.state.timestamp.epoch,
token_in_iteration=self.state.timestamp.token,
)

self.engine.run_event(Event.AFTER_LOAD)

# reseed here. This helps with a couple of issues:
Expand Down

0 comments on commit 3dd2e0a

Please sign in to comment.