Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jindongwang committed Apr 25, 2024
2 parents 2f7ef9c + cbde64f commit 12f9842
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions code/DeepDA/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def load_data(data_folder, batch_size, train, num_workers=0, **kwargs):

def get_data_loader(dataset, batch_size, shuffle=True, drop_last=False, num_workers=0, infinite_data_loader=False, **kwargs):
if not infinite_data_loader:
return torch.utils.data.DataLoader(dataset, batch_size=batch_size, shuffle=True, drop_last=drop_last, num_workers=num_workers, **kwargs)
return torch.utils.data.DataLoader(dataset, batch_size=batch_size, shuffle=shuffle, drop_last=drop_last, num_workers=num_workers, **kwargs)
else:
return InfiniteDataLoader(dataset, batch_size=batch_size, shuffle=True, drop_last=drop_last, num_workers=num_workers, **kwargs)
return InfiniteDataLoader(dataset, batch_size=batch_size, shuffle=shuffle, drop_last=drop_last, num_workers=num_workers, **kwargs)

class _InfiniteSampler(torch.utils.data.Sampler):
"""Wraps another Sampler to yield an infinite stream."""
Expand Down Expand Up @@ -66,4 +66,4 @@ def __iter__(self):
yield next(self._infinite_iterator)

def __len__(self):
return 0 # Always return 0
return 0 # Always return 0

0 comments on commit 12f9842

Please sign in to comment.