Should Lightning have separate setup and teardown hooks for each stage? #6401
Unanswered
ananthsub
asked this question in
Lightning Trainer API: Trainer, LightningModule, LightningDataModule
Replies: 2 comments 2 replies
-
+1 for separate hooks. to keep things inline with the rest of the API |
Beta Was this translation helpful? Give feedback.
1 reply
-
I also like to have them. And I feel that we should go over all the hooks we currently have and see if they're still needed and which ones are missing. Especially the latter may be true for some of them after the accelerator refactor. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Based on #6368
LightningModules and DataModules currently support a
setup
API which takes an optionalstage
argument.#6386 addresses some issues in the setup/teardown lifecycle, so I was wondering if we should take this further.
Pros of making the separate hooks for each stage:
stage
that user code might not handle. As a result, adding new stages becomes opt-in for users, as they have to implement the corresponding hook in their lightning/data moduletrain/validation/test/predict
defined as separate hookshas_setup_{stage}
attributes since it'll be obvious when the hooks are calledCons:
@PyTorchLightning/core-contributors
Meta-question: should API proposals start out as discussions? Or should this be in an issue instead as an RFC?
Beta Was this translation helpful? Give feedback.
All reactions