Best Practice Sub-modules and Hyperparameters #5964
Unanswered
cheind
asked this question in
Lightning Trainer API: Trainer, LightningModule, LightningDataModule
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey,
what is the best practice when it comes to checkpointing user specified sub-modules passed to
__init__
in Lightning? Consider a general network consisting of a backbone net and a variable number of heads:Is the following advised?
Will the above correctly initialize backbone and head structure? This would mean that
save_hyperparameters()
supports pickling of arbitrary Python objects. According to PyTorch, this is not recommended as it may break your code when at a later point ResNet class changes. Yet, the above strategy seems to be used by LightningFlash.What's the alternative then? Creating a sub-class for each specific model and making the hyper-parameters simple types? I.e
(where I assume now that
Model
does not save hyperparameters).Beta Was this translation helpful? Give feedback.
All reactions