Skip to content

Commit

Permalink
Fix (again) NNTemplateCore callback
Browse files Browse the repository at this point in the history
  • Loading branch information
lucmos authored Mar 20, 2023
1 parent a85b98e commit 99544f7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/nn_core/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ def on_train_end(self, trainer: pl.Trainer, pl_module: pl.LightningModule) -> No
def on_save_checkpoint(
self, trainer: pl.Trainer, pl_module: pl.LightningModule, checkpoint: Dict[str, Any]
) -> None:
if trainer.logger is not None:
if self._is_nnlogger(trainer):
trainer.logger.on_save_checkpoint(trainer=trainer, pl_module=pl_module, checkpoint=checkpoint)
metadata = getattr(trainer.datamodule, "metadata", None)
if metadata is not None:
checkpoint[METADATA_KEY] = metadata
metadata = getattr(trainer.datamodule, "metadata", None)
if metadata is not None:
checkpoint[METADATA_KEY] = metadata

0 comments on commit 99544f7

Please sign in to comment.