From 20148fbf86a50c56868e7ca19d232ebdbb7085bd Mon Sep 17 00:00:00 2001 From: janEbert <janpublicebert@posteo.net> Date: Sun, 3 Nov 2024 11:57:55 +0100 Subject: [PATCH] Do not shuffle test/validation splits The argument defaults to `True`, but shuffling these is redundant. --- pytorch-ddp-example/main.py | 10 ++++++++-- pytorch-fsdp-example/main.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/pytorch-ddp-example/main.py b/pytorch-ddp-example/main.py index aaecdd7..7c23847 100644 --- a/pytorch-ddp-example/main.py +++ b/pytorch-ddp-example/main.py @@ -133,8 +133,14 @@ def prepare_datasets(args, device): shuffle=True, seed=args.seed, ) - valid_sampler = torch.utils.data.distributed.DistributedSampler(valid_dset) - test_sampler = torch.utils.data.distributed.DistributedSampler(test_dset) + valid_sampler = torch.utils.data.distributed.DistributedSampler( + valid_dset, + shuffle=False, + ) + test_sampler = torch.utils.data.distributed.DistributedSampler( + test_dset, + shuffle=False, + ) train_dset = torch.utils.data.DataLoader( train_dset, diff --git a/pytorch-fsdp-example/main.py b/pytorch-fsdp-example/main.py index 991e6fc..e1d16f1 100644 --- a/pytorch-fsdp-example/main.py +++ b/pytorch-fsdp-example/main.py @@ -181,8 +181,14 @@ def prepare_datasets(args, device): shuffle=True, seed=args.seed, ) - valid_sampler = torch.utils.data.distributed.DistributedSampler(valid_dset) - test_sampler = torch.utils.data.distributed.DistributedSampler(test_dset) + valid_sampler = torch.utils.data.distributed.DistributedSampler( + valid_dset, + shuffle=False, + ) + test_sampler = torch.utils.data.distributed.DistributedSampler( + test_dset, + shuffle=False, + ) train_dset = torch.utils.data.DataLoader( train_dset, -- GitLab