Skip to content

Commit

Permalink
Fix finite IterableDataset test on multiple GPUs (#14445)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgugger authored Nov 18, 2021
1 parent da36c55 commit 83ef8bc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,13 +1069,17 @@ def test_training_iterable_dataset(self):
self.assertIsInstance(loader.sampler, torch.utils.data.dataloader._InfiniteConstantSampler)

def test_training_finite_iterable_dataset(self):
num_gpus = max(1, get_gpu_count())
if num_gpus > 2:
return

config = RegressionModelConfig()
model = RegressionPreTrainedModel(config)

batch_size = 1
num_samples = 10

available_steps = num_samples // batch_size
available_steps = num_samples // (batch_size * num_gpus)

data = FiniteIterableDataset(length=num_samples)
train_args = TrainingArguments(
Expand Down

0 comments on commit 83ef8bc

Please sign in to comment.