Skip to content

Commit

Permalink
TST: Skip test on multi-GPU as DataParallel fails (#2234)
Browse files Browse the repository at this point in the history
This test fails in multi-GPU setting because transformers.Trainer
switches to DataParallel. As this is not a commonly used parallelization
strategy, it should be okay to just skip this.
  • Loading branch information
BenjaminBossan authored Nov 26, 2024
1 parent ca1b3b1 commit d13d7a4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_decoder_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,12 @@ def test_prompt_learning_with_gradient_checkpointing(self, test_name, model_id,
# Test prompt learning methods with gradient checkpointing in a semi realistic setting.
# Prefix tuning does not work if the model uses the new caching implementation. In that case, a helpful error
# should be raised.

# skip if multi GPU, since this results in DataParallel usage by Trainer, which fails with "CUDA device
# assertion", breaking subsequent tests
if torch.cuda.device_count() > 1:
pytest.skip("Skip prompt_learning_with_gradient_checkpointing test on multi-GPU setups")

peft_config = config_cls(
base_model_name_or_path=model_id,
**config_kwargs,
Expand Down

0 comments on commit d13d7a4

Please sign in to comment.