Skip to content

Commit 92f0103

Browse files
committed
Update device assignment logic to support 'mps' accelerator
1 parent b7ca4d3 commit 92f0103

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lightning/pytorch/trainer/connectors/accelerator_connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ def _check_and_init_precision(self) -> Precision:
515515
rank_zero_info(
516516
f"Using {'16bit' if self._precision_flag == '16-mixed' else 'bfloat16'} Automatic Mixed Precision (AMP)"
517517
)
518-
device = "cpu" if self._accelerator_flag == "cpu" else "cuda"
518+
device = self._accelerator_flag if self._accelerator_flag in ("cpu", "mps") else "cuda"
519519
return MixedPrecision(self._precision_flag, device) # type: ignore[arg-type]
520520

521521
raise RuntimeError("No precision set")

0 commit comments

Comments
 (0)