From cd15bfc3ce6aa03f08da575469bb0860d6075504 Mon Sep 17 00:00:00 2001 From: William Falcon Date: Fri, 24 Apr 2020 09:29:39 -0400 Subject: [PATCH] fixed new amp bugs (#1593) --- pytorch_lightning/trainer/__init__.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pytorch_lightning/trainer/__init__.py b/pytorch_lightning/trainer/__init__.py index 41b7b1b9..42f92979 100644 --- a/pytorch_lightning/trainer/__init__.py +++ b/pytorch_lightning/trainer/__init__.py @@ -720,6 +720,23 @@ Set to True to reload dataloaders every epoch. train_loader = model.train_dataloader() for batch in train_loader: +replace_sampler_ddp +^^^^^^^^^^^^^^^^^^^ +Enables auto adding of distributed sampler. + +Example:: + + # default used by the Trainer + trainer = Trainer(replace_sampler_ddp=True) + +By setting to False, you have to add your own distributed sampler: + +Example:: + + # default used by the Trainer + sampler = torch.utils.data.distributed.DistributedSampler(dataset, shuffle=True) + dataloader = DataLoader(dataset, batch_size=32, sampler=sampler) + resume_from_checkpoint ^^^^^^^^^^^^^^^^^^^^^^ To resume training from a specific checkpoint pass in the path here.