From 84c10346fb777c827df58b264a726572225a45c6 Mon Sep 17 00:00:00 2001 From: James Reynolds Date: Wed, 31 Aug 2022 03:29:37 -0600 Subject: [PATCH] check if torch.backends has mps before calling it --- ldm/dream/devices.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ldm/dream/devices.py b/ldm/dream/devices.py index 9008f7871c..240754dd36 100644 --- a/ldm/dream/devices.py +++ b/ldm/dream/devices.py @@ -4,7 +4,7 @@ def choose_torch_device() -> str: '''Convenience routine for guessing which GPU device to run model on''' if torch.cuda.is_available(): return 'cuda' - if torch.backends.mps.is_available(): + if hasattr(torch.backends, 'mps') and torch.backends.mps.is_available(): return 'mps' return 'cpu'