Skip to content

Commit

Permalink
make sure to save on the last step (#1615)
Browse files Browse the repository at this point in the history
  • Loading branch information
winglian authored May 14, 2024
1 parent 0298273 commit 1634ac8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/axolotl/utils/callbacks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,17 @@ def on_train_begin(
class SaveModelOnTrainEndCallback(TrainerCallback):
"""Callback to save model on train end"""

def on_step_end( # pylint: disable=unused-argument
self,
args: TrainingArguments,
state: TrainerState,
control: TrainerControl,
**kwargs,
):
# Save
if state.global_step >= state.max_steps:
control.should_save = True

def on_train_end( # pylint: disable=unused-argument
self, args, state, control, **kwargs
):
Expand Down

0 comments on commit 1634ac8

Please sign in to comment.