chore: refactor SaveModelCallback to stop handle fractional save_steps (#2291) [skip ci]
This commit is contained in:
@@ -4,7 +4,6 @@ from __future__ import annotations
|
||||
|
||||
import gc
|
||||
import logging
|
||||
import math
|
||||
import os
|
||||
import traceback
|
||||
from shutil import copyfile
|
||||
@@ -830,13 +829,6 @@ class SaveModelCallback(TrainerCallback):
|
||||
# Save
|
||||
if state.global_step >= state.max_steps:
|
||||
control.should_save = True
|
||||
elif (
|
||||
args.save_strategy == IntervalStrategy.STEPS
|
||||
and state.save_steps < 1.0
|
||||
and state.global_step % math.ceil(state.save_steps * state.max_steps) == 0
|
||||
):
|
||||
# workaround to save model on fractional save_steps
|
||||
control.should_save = True
|
||||
|
||||
def on_train_end( # pylint: disable=unused-argument
|
||||
self, args, state, control, **kwargs
|
||||
|
||||
Reference in New Issue
Block a user