From 3f35e2e8661ef91a1fd8362f62fa1920934550fe Mon Sep 17 00:00:00 2001 From: wenmeng zhou Date: Tue, 21 Feb 2023 11:40:07 +0800 Subject: [PATCH] add shuffle option for single gpu finetunning (#122) --- modelscope/trainers/trainer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modelscope/trainers/trainer.py b/modelscope/trainers/trainer.py index 715d9946..3995fcfa 100644 --- a/modelscope/trainers/trainer.py +++ b/modelscope/trainers/trainer.py @@ -975,6 +975,8 @@ class EpochBasedTrainer(BaseTrainer): dataset, num_replicas=world_size, rank=rank, shuffle=shuffle) else: sampler = None + if not isinstance(dataset, torch.utils.data.IterableDataset): + kwargs['shuffle'] = shuffle batch_sampler = None