mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
Merge branch 'development' of https://github.com/pbaylies/stable-diffusion into development
This commit is contained in:
@@ -13,8 +13,9 @@ def choose_torch_device() -> str:
|
||||
def choose_autocast_device(device):
|
||||
'''Returns an autocast compatible device from a torch device'''
|
||||
device_type = device.type # this returns 'mps' on M1
|
||||
# autocast only supports cuda or cpu
|
||||
if device_type in ('cuda','cpu'):
|
||||
if device_type == 'cuda':
|
||||
return device_type,autocast
|
||||
elif device_type == 'cpu':
|
||||
return device_type,nullcontext
|
||||
else:
|
||||
return 'cpu',nullcontext
|
||||
|
||||
Reference in New Issue
Block a user