def test_error_with_invalid_accelerator(tmp_path):
    """Test DeepSpeedStrategy raises an exception if an invalid accelerator is used."""
    trainer = Trainer(
        default_root_dir=tmp_path,
        accelerator="cpu",
        strategy="deepspeed",
        fast_dev_run=True,
    )
    model = BoringModel()
    with pytest.raises(RuntimeError, match="DeepSpeed strategy is only supported on CUDA"):
        trainer.fit(model)
Test DeepSpeedStrategy raises an exception if an invalid accelerator is used.
tests/tests_pytorch/strategies/test_deepspeed.py