41
41
SLURMEnvironment ,
42
42
TorchElasticEnvironment ,
43
43
)
44
- from pytorch_lightning .utilities .exceptions import MisconfigurationException
45
44
from pytorch_lightning .utilities import _GPU_AVAILABLE
45
+ from pytorch_lightning .utilities .exceptions import MisconfigurationException
46
46
from tests .helpers .boring_model import BoringModel
47
47
from tests .helpers .runif import RunIf
48
48
@@ -562,7 +562,7 @@ def test_accelerator_cpu():
562
562
563
563
with pytest .raises (MisconfigurationException , match = "You passed `accelerator='gpu'`, but GPUs are not available" ):
564
564
trainer = Trainer (accelerator = "gpu" )
565
-
565
+
566
566
# with pytest.raises(MisconfigurationException, match="You passed `accelerator='gpu'`, but GPUs are not available"):
567
567
# trainer = Trainer(accelerator="cpu", gpus=1)
568
568
@@ -575,7 +575,9 @@ def test_accelerator_gpu():
575
575
assert trainer ._device_type == "gpu"
576
576
assert isinstance (trainer .accelerator , GPUAccelerator )
577
577
578
- with pytest .raises (MisconfigurationException , match = "You passed `accelerator='gpu'`, but you didn't pass `gpus` to `Trainer`" ):
578
+ with pytest .raises (
579
+ MisconfigurationException , match = "You passed `accelerator='gpu'`, but you didn't pass `gpus` to `Trainer`"
580
+ ):
579
581
trainer = Trainer (accelerator = "gpu" )
580
582
581
583
trainer = Trainer (accelerator = "auto" , gpus = 1 )
@@ -585,8 +587,8 @@ def test_accelerator_gpu():
585
587
586
588
587
589
def test_accelerator_cpu_with_gpus_flag ():
588
-
590
+
589
591
trainer = Trainer (accelerator = "cpu" , gpus = 1 )
590
592
591
593
assert trainer ._device_type == "cpu"
592
- assert isinstance (trainer .accelerator , GPUAccelerator )
594
+ assert isinstance (trainer .accelerator , GPUAccelerator )
0 commit comments