Skip to content

Commit a0a6bc2

Browse files
author
Dariush Wahdany
committed
feat: update lightning example to lightning 2.0
1 parent 95df090 commit a0a6bc2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

examples/mnist_lightning.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,8 @@ def configure_optimizers(self):
9999
optimizer = optim.SGD(self.parameters(), lr=self.lr, momentum=0)
100100

101101
if self.enable_dp:
102-
data_loader = (
103-
# soon there will be a fancy way to access train dataloader,
104-
# see https://github.com/PyTorchLightning/pytorch-lightning/issues/10430
105-
self.trainer._data_connector._train_dataloader_source.dataloader()
106-
)
102+
self.trainer.fit_loop.setup_data()
103+
dataloader = self.trainer.train_dataloader
107104

108105
# transform (model, optimizer, dataloader) to DP-versions
109106
if hasattr(self, "dp"):

0 commit comments

Comments
 (0)