You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are scenarios where it makes sense to supply nn.Modules as arguments when initialising a LightningModule, indeed this seems to be endorsed in some of the Lightning docs, however it is recommended to ignore the nn.Modules when calling self.save_hyperparameters(). This pattern is inconvenient when it comes to saving/loading models, since if you simply save the LightningModule you will be unable to load it again, as you will not have the necessary information to instantiate the nn.Modules (although their weights will be stored in the checkpoint).
Pitch
When suppling nn.Modules as arguments to LightningModules, checkpoints currently save only the weights of the nn.Modules which is insufficient to instantiate the nn.Modules as part of loading the LightningModule.
Add functionality to seamlessly save nn.Modules provided as arguments to LightningModules such that the LightningModule can be loaded without having to separately save the initialisation arguments of the nn.Modules and initialise the nn.Modules before supplying them as arguments when loading the LightningModule from the checkpoint.
Description & Motivation
There are scenarios where it makes sense to supply nn.Modules as arguments when initialising a LightningModule, indeed this seems to be endorsed in some of the Lightning docs, however it is recommended to ignore the nn.Modules when calling
self.save_hyperparameters()
. This pattern is inconvenient when it comes to saving/loading models, since if you simply save the LightningModule you will be unable to load it again, as you will not have the necessary information to instantiate the nn.Modules (although their weights will be stored in the checkpoint).Pitch
When suppling nn.Modules as arguments to LightningModules, checkpoints currently save only the weights of the nn.Modules which is insufficient to instantiate the nn.Modules as part of loading the LightningModule.
Add functionality to seamlessly save nn.Modules provided as arguments to LightningModules such that the LightningModule can be loaded without having to separately save the initialisation arguments of the nn.Modules and initialise the nn.Modules before supplying them as arguments when loading the LightningModule from the checkpoint.
Alternatives
No response
Additional context
No response
cc @Borda
The text was updated successfully, but these errors were encountered: