MCPcopy
hub / github.com/OpenMotionLab/MotionGPT / on_train_epoch_end

Method on_train_epoch_end

mGPT/callback.py:177–200  ·  view source on GitHub ↗
(self,
                           trainer: Trainer,
                           pl_module: LightningModule,
                           padding=False,
                           **kwargs)

Source from the content-addressed store, hash-verified

175 self.logger.info("Sanity checking ok.")
176
177 def on_train_epoch_end(self,
178 trainer: Trainer,
179 pl_module: LightningModule,
180 padding=False,
181 **kwargs) -> None:
182 metric_format = f"{{:.{self.precision}e}}"
183 line = f"Epoch {trainer.current_epoch}"
184 if padding:
185 line = f"{line:>{len('Epoch xxxx')}}" # Right padding
186
187 if trainer.current_epoch % self.log_every_n_steps == 0:
188 metrics_str = []
189
190 losses_dict = trainer.callback_metrics
191 for metric_name, dico_name in self.metric_monitor.items():
192 if dico_name in losses_dict:
193 metric = losses_dict[dico_name].item()
194 metric = metric_format.format(metric)
195 metric = f"{metric_name} {metric}"
196 metrics_str.append(metric)
197
198 line = line + ": " + " ".join(metrics_str)
199
200 self.logger.info(line)

Callers

nothing calls this directly

Calls 1

itemsMethod · 0.80

Tested by

no test coverage detected