Skip to content

Commit a547c33

Browse files
magnusviriJames Reynolds
andauthored
check if torch.backends has mps before calling it (#245)
Co-authored-by: James Reynolds <[email protected]>
1 parent 31b77db commit a547c33

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ldm/dream/devices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ def choose_torch_device() -> str:
44
'''Convenience routine for guessing which GPU device to run model on'''
55
if torch.cuda.is_available():
66
return 'cuda'
7-
if torch.backends.mps.is_available():
7+
if hasattr(torch.backends, 'mps') and torch.backends.mps.is_available():
88
return 'mps'
99
return 'cpu'
1010

0 commit comments

Comments
 (0)