* sampler

* check for dataloader type

* check for dataloader type

* fixed sampler cases
This commit is contained in:
William Falcon 2020-04-01 12:57:36 -04:00 committed by GitHub
parent 7de51f78ac
commit e48422df38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -79,11 +79,11 @@ class TrainerDataLoadingMixin(ABC):
if not isinstance(dataloader, DataLoader):
return dataloader
# don't add sampler when user gives one
if dataloader.sampler is not None:
return dataloader
need_dist_sampler = self.use_ddp or self.use_ddp2 or self.use_tpu
no_sampler_added = dataloader.sampler is None
if need_dist_sampler and no_sampler_added:
if self.use_ddp or self.use_ddp2 or self.use_tpu:
dl_args = {
'dataset': dataloader.dataset,
'batch_size': dataloader.batch_size,