Init tensor with device agnostic code without it showing up in the state dict #8450
Unanswered
Robinysh
asked this question in
Lightning Trainer API: Trainer, LightningModule, LightningDataModule
Replies: 1 comment
-
Dear @Robinysh, You could override the state_dict function of your LightningModule and drop those tensors. Best, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This is the current recommended way for initializing tensors inside LightningModules with device-agnostic code.
Unfortunately, for my current use case, the tensor now shows up in the model state dict as an undesired side effect. My pipeline consists of loading the save file across runs, and sometimes some particular tensors change sizes, which makes my savefile incompatible. I don't want to save and load those particular tensors. Is there a way to work around this?
Beta Was this translation helpful? Give feedback.
All reactions