Saving a model without saving the data

Most of the lighting models I’ve seen save datasets and dataloaders as class members. Then when the model is finished training there has to be some kind of weird hack to save the model without saving the data. Some people manually delete the data objects from the lighting object before saving. Others discard the entire lightning object and only save key inner parts which get reassembled later. Is there a better way?

Only the members of LightningModule are saved, if dataset is not a member of the model then it shouldn’t be saved. could you share a snippet for your LightningModule to reproduce this?