DataModules should have a reference to the Trainer
🚀 Feature
The DataModule should have a reference to the Trainer, so attributes on the Trainer can be accessed during prepare_data, setup, and the dataloader methods.
cc @nateraw
Motivation
Further uncouple datamodules and lightning modules. For instance, it can be useful for DataModules to know what the current epoch is during training. If I want to use the DataModules, I don't have access to this. However this is readily available if I define my train_dataloader in the LightningModule instead.
Pitch
We can follow the same setup that LightningModules have and how the trainer is initialized for them