Skip to content

Commit 531a826

Browse files
authored
feat(cli): after_instantiate_classes hook
1 parent 3627c5b commit 531a826

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lightning/pytorch/cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ def __init__(
389389
self._add_instantiators()
390390
self.before_instantiate_classes()
391391
self.instantiate_classes()
392+
self.after_instantiate_classes()
392393

393394
if self.subcommand is not None:
394395
self._run_subcommand(self.subcommand)
@@ -560,6 +561,9 @@ def instantiate_classes(self) -> None:
560561
self._add_configure_optimizers_method_to_model(self.subcommand)
561562
self.trainer = self.instantiate_trainer()
562563

564+
def after_instantiate_classes(self) -> None:
565+
"""Implement to run some code after instantiating the classes."""
566+
563567
def instantiate_trainer(self, **kwargs: Any) -> Trainer:
564568
"""Instantiates the trainer.
565569

0 commit comments

Comments
 (0)