Skip to content

Commit 8910453

Browse files
committed
fix the issue with cuda device on macos
1 parent 0a8ad3d commit 8910453

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lightning/fabric/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def _get_num_processes(accelerator: str, devices: str) -> int:
198198
elif accelerator == "tpu":
199199
raise ValueError("Launching processes for TPU through the CLI is not supported.")
200200
elif accelerator == "auto" or accelerator is None:
201-
if torch.cuda.is_available():
201+
if torch.cuda.is_available() and torch.cuda.device_count() > 0:
202202
parsed_devices = CUDAAccelerator.parse_devices(devices)
203203
elif torch.backends.mps.is_available() and torch.backends.mps.is_built():
204204
parsed_devices = MPSAccelerator.parse_devices(devices)

0 commit comments

Comments
 (0)