@@ -639,7 +639,8 @@ def get_dataloaders(self, model):
639
639
# call warnings from proc zero only which triggers dataloaders
640
640
# if those have to download data it will only happen on proc 0
641
641
if self .proc_rank == 0 :
642
- if self .use_ddp or self .use_ddp2 and not isinstance (self .get_train_dataloader ().sampler , DistributedSampler ):
642
+ on_ddp = self .use_ddp or self .use_ddp2
643
+ if on_ddp and not isinstance (self .get_train_dataloader ().sampler , DistributedSampler ):
643
644
msg = """
644
645
You're using multiple gpus and multiple nodes without using a DistributedSampler
645
646
to assign a subset of your data to each process. To silence this warning, pass a
@@ -658,14 +659,14 @@ def get_dataloaders(self, model):
658
659
"""
659
660
warnings .warn (msg )
660
661
661
- if self . use_ddp or self . use_ddp2 and self .get_val_dataloaders is not None :
662
+ if on_ddp and self .get_val_dataloaders is not None :
662
663
for dataloader in self .get_val_dataloaders ():
663
664
if not isinstance (dataloader .sampler , DistributedSampler ):
664
665
msg = """
665
666
Your val_dataloader(s) don't use DistributedSampler.
666
- You're using multiple gpus and multiple nodes without using a DistributedSampler
667
- to assign a subset of your data to each process. To silence this warning, pass a
668
- DistributedSampler to your DataLoader.
667
+ You're using multiple gpus and multiple nodes without using a
668
+ DistributedSampler to assign a subset of your data to each process.
669
+ To silence this warning, pass a DistributedSampler to your DataLoader.
669
670
670
671
ie: this:
671
672
dataset = myDataset()
@@ -681,14 +682,14 @@ def get_dataloaders(self, model):
681
682
warnings .warn (msg )
682
683
break
683
684
684
- if self . use_ddp or self . use_ddp2 and self .get_test_dataloaders is not None :
685
+ if on_ddp and self .get_test_dataloaders is not None :
685
686
for dataloader in self .get_test_dataloaders ():
686
687
if not isinstance (dataloader .sampler , DistributedSampler ):
687
688
msg = """
688
689
Your test_dataloader(s) don't use DistributedSampler.
689
- You're using multiple gpus and multiple nodes without using a DistributedSampler
690
- to assign a subset of your data to each process. To silence this warning, pass a
691
- DistributedSampler to your DataLoader.
690
+ You're using multiple gpus and multiple nodes without using a
691
+ DistributedSampler to assign a subset of your data to each process.
692
+ To silence this warning, pass a DistributedSampler to your DataLoader.
692
693
693
694
ie: this:
694
695
dataset = myDataset()
0 commit comments