From d721b4eab96d31a9e3948964fbe20e6d4b42e8fe Mon Sep 17 00:00:00 2001 From: Zach Mueller Date: Wed, 1 Nov 2023 16:15:03 +0000 Subject: [PATCH] Rewrite --- src/accelerate/data_loader.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/accelerate/data_loader.py b/src/accelerate/data_loader.py index 1c1ba2a8174..7bb9d31738a 100644 --- a/src/accelerate/data_loader.py +++ b/src/accelerate/data_loader.py @@ -841,9 +841,7 @@ def prepare_data_loader( sampler = getattr(dataloader.batch_sampler, "sampler", None) if isinstance(sampler, RandomSampler): # CPU's specifically do not require this workaround - if num_processes == 1 and (device.type == "cpu"): - pass - else: + if not ((num_processes == 1) and (device.type == "cpu")): # When iterating through the dataloader we want to ensure that # on each process we are iterating through the same # samples in the same order if a seed is set. This requires a tweak