Best practice for saving only specific parts of the pl.LightningModule #17898
Unanswered
DerEchteFeuerpfeil
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
Uh oh!
There was an error while loading. Please reload this page.
-
Hello community, I have a question regarding best practice.
I am using TorchMetrics to track CLIP score and FID score in my VAE training. For that, I initialized these metrics in my
VAEXperiment
like so:I am saving these to the LightningModule because I need to access them at various points in training and validation without reinitialising them, e.g. in
on_validation_end
. The only model I am interested in training and saving is the VAE (self.model
). The rest is just for tracking metrics.When I start training with the Trainer however, I see the following in my shell:
which makes sense because I added them to the LightningModule directly. My issue now is, I don't want to save these, they just bloat my checkpoint files. But without code modification, they get saved automatically.
What is the best practice here? Is TorchMetrics not supposed to be in the LightningModule? Can I remove FID and CLIP from the checkpoint in
on_save_checkpoint
? If so, is this regarded as best practice?Looking forward to your feedback :)
Beta Was this translation helpful? Give feedback.
All reactions