How to change dataset after each epoch? #9511
Unanswered
VietTralala
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
-
I want to change my dataset after each training epoch. So I created a
Callback
and implementedon_train_epoch_end(self,trainer,pl_module)
andon_validation_epoch_end(self,trainer,pl_module)
which will call a datamodule function using the passed trainer as follows:trainer.datamodule.switch_dataset(...)
I implemented theswitch_dataset(..)
function for my custom LightningDataModule which changes the attributeself.dataset
of the LightningDataModule. This would then effect the train_dataloder and val_dataloader calls. However I can't access theswitch_dataset()
function. Python always complains with:AttributeError: 'MyDataModule' object has no attribute 'switch_dataset'
eventhough the class definition is correct. What am I doing wrong/How can I achieve to switch datasets after each epoch?Please delete/ignore this question. My issue was unrelated to pytorch lightning
Beta Was this translation helpful? Give feedback.
All reactions