Skip to content

Commit

Permalink
fix(loader): no support for shuffle with DDP
Browse files Browse the repository at this point in the history
  • Loading branch information
jyaacoub committed Aug 19, 2024
1 parent 862dffc commit 7833334
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def load_distributed_DataLoaders(num_replicas:int, rank:int, seed:int, data:str,
loaders = {}
for d in loaded_datasets:
dataset = loaded_datasets[d]
sampler = DistributedSampler(dataset, shuffle=True,
sampler = DistributedSampler(dataset, shuffle=False,
num_replicas=num_replicas,
rank=rank, seed=seed)

Expand All @@ -327,7 +327,7 @@ def load_distributed_DataLoaders(num_replicas:int, rank:int, seed:int, data:str,
sampler=sampler,
batch_size=bs, # should be per gpu batch size (local batch size)
num_workers=num_workers,
shuffle=True,
shuffle=False, # mut exclusive with DDP
pin_memory=True,
drop_last=True) # drop last batch if not divisible by batch size
loaders[d] = loader
Expand Down Expand Up @@ -418,4 +418,4 @@ def wrapper(*args, **kwargs):
# Return the function call output
return func(*args, **kwargs)
return wrapper
return decorator
return decorator

0 comments on commit 7833334

Please sign in to comment.