MCPcopy Create free account
hub / github.com/OpenMOSS/rope_pp / CheckpointingCallback

Class CheckpointingCallback

utils/callback_utils.py:72–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70
71
72class CheckpointingCallback(TrainerCallback):
73 def __init__(self, steps_to_save):
74 self.steps_to_save = steps_to_save
75
76 self.rank = torch.distributed.get_rank()
77
78 def on_step_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs):
79 if state.global_step in self.steps_to_save:
80 control.should_save = True
81 control.should_evaluate = True
82 if self.rank == 0:
83 print(f"Saving checkpoint at step {state.global_step}")
84 return control

Callers 10

train_fope.pyFile · 0.90
train_alibi.pyFile · 0.90
train_pythia.pyFile · 0.90
train_rope_pp.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected