-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
designIncludes a design discussionIncludes a design discussiondiscussionIn a discussion stageIn a discussion stagerefactor
Description
🚀 Feature
Carrying forward discussion from #7289 (comment)
Remove these settings to give more control to the users and making trainer execution easier
https://github.com/PyTorchLightning/pytorch-lightning/blob/490cc57809ebeba19003b4101393a8a058217c31/pytorch_lightning/core/datamodule.py#L33-L52
Motivation
Consecutive calls like this have different behavior:
dm = MyDataModule()
model = MyLightningModule()
trainer.fit(model, datamodule=dm)
trainer.fit(model, datamodule=dm)
The second trainer.fit call will not run the prepare data, setup, or teardown hooks.
Removing this check gives us these advantages
- Simpler, consistent hook execution: More control for users for how they want to handle state changes
- Less state management inside the trainer and datamodule: less framework overhead/maintenance for us long term and easier debuggability
cc @carmocca
Pitch
Remove this code:
- https://github.com/PyTorchLightning/pytorch-lightning/blob/490cc57809ebeba19003b4101393a8a058217c31/pytorch_lightning/core/datamodule.py#L27-L97
- https://github.com/PyTorchLightning/pytorch-lightning/blob/490cc57809ebeba19003b4101393a8a058217c31/pytorch_lightning/core/datamodule.py#L162-L173
- https://github.com/PyTorchLightning/pytorch-lightning/blob/490cc57809ebeba19003b4101393a8a058217c31/pytorch_lightning/core/datamodule.py#L230-L309
- https://github.com/PyTorchLightning/pytorch-lightning/blob/490cc57809ebeba19003b4101393a8a058217c31/pytorch_lightning/trainer/trainer.py#L1169-L1170
- https://github.com/PyTorchLightning/pytorch-lightning/blob/490cc57809ebeba19003b4101393a8a058217c31/pytorch_lightning/trainer/connectors/data_connector.py#L63
- https://github.com/PyTorchLightning/pytorch-lightning/blob/490cc57809ebeba19003b4101393a8a058217c31/pytorch_lightning/trainer/trainer.py#L1143-L1144
cc @carmocca
Alternatives
Additional context
Metadata
Metadata
Assignees
Labels
designIncludes a design discussionIncludes a design discussiondiscussionIn a discussion stageIn a discussion stagerefactor