INNER CODE UNIT · Python

EvaluateFirstStepCallback

HIT-SCIR/Chinese-Mixtral-8x7B · train.py:185

class EvaluateFirstStepCallback(TrainerCallback):
    # Make Trainer evaluate before first training step.
    # `--logging_first_step` will not work, maybe this is a bug.
    # We use this callback to deal with this.
    # See https://discuss.huggingface.co/t/how-to-evaluate-before-first-training-step/18838/7
    def on_step_begin(self, args, state, control, **kwargs):
        if state.global_step == 0:
            control.should_evaluate = True


def train():
    model_args: ModelArguments
    data_args: DataArguments
    peft_args: PeftArguments
    training_args: TrainingArguments
    parser = transformers.HfArgumentParser((ModelArguments, DataArguments, PeftArguments, TrainingArguments))
    model_args, data_args, peft_args, training_args = parser.parse_args_into_dataclasses()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…