MCPcopy Create free account
hub / github.com/OpenSparseLLMs/MoM / on_train_begin

Method on_train_begin

training/flame/logging.py:41–69  ·  view source on GitHub ↗

r""" Event called at the beginning of training.

(
        self,
        args: TrainingArguments,
        state: TrainerState,
        control: TrainerControl,
        **kwargs
    )

Source from the content-addressed store, hash-verified

39 self.last_time = self.start_time
40
41 def on_train_begin(
42 self,
43 args: TrainingArguments,
44 state: TrainerState,
45 control: TrainerControl,
46 **kwargs
47 ):
48 r"""
49 Event called at the beginning of training.
50 """
51 if state.is_local_process_zero:
52 if not args.resume_from_checkpoint:
53 self.start_time = time.time()
54 self.elapsed_time = 0
55 else:
56 self.start_time = state.stateful_callbacks['LogCallback']['start_time']
57 self.elapsed_time = state.stateful_callbacks['LogCallback']['elapsed_time']
58
59 if args.save_on_each_node:
60 if not state.is_local_process_zero:
61 return
62 else:
63 if not state.is_world_process_zero:
64 return
65
66 self.last_time = time.time()
67 if os.path.exists(os.path.join(args.output_dir, LOG_FILE_NAME)) and args.overwrite_output_dir:
68 logger.warning("Previous log file in this folder will be deleted.")
69 os.remove(os.path.join(args.output_dir, LOG_FILE_NAME))
70
71 def on_log(
72 self,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected