def METHOD_NAME(
        self,
        args: TrainingArguments,
        state: TrainerState,
        control: TrainerControl,
        **kwargs
):
    if self.start_global_step < 0 and self.start_epoch < 0:
        # if both values are unset
        self.start_epoch = state.epoch
        self.start_global_step = state.global_step
    else:
        # recover from previous run
        state.epoch = self.start_epoch
        state.global_step = self.start_global_step
    return control