mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-11-24 17:24:29 +01:00
Bring back the ability to run on CPU on PCs with CUDA-compatible GPUs
This commit is contained in:
parent
8907dabd4c
commit
0fd706f392
@ -65,10 +65,12 @@ def get_device_delta(render_devices, active_devices):
|
||||
|
||||
|
||||
def is_mps_available():
|
||||
return platform.system() == "Darwin" and \
|
||||
hasattr(torch.backends, 'mps') and \
|
||||
torch.backends.mps.is_available() and \
|
||||
torch.backends.mps.is_built()
|
||||
return (
|
||||
platform.system() == "Darwin"
|
||||
and hasattr(torch.backends, "mps")
|
||||
and torch.backends.mps.is_available()
|
||||
and torch.backends.mps.is_built()
|
||||
)
|
||||
|
||||
|
||||
def is_cuda_available():
|
||||
@ -213,7 +215,7 @@ def is_device_compatible(device):
|
||||
log.error(str(e))
|
||||
return False
|
||||
|
||||
if not is_cuda_available():
|
||||
if device in ("cpu", "mps"):
|
||||
return True
|
||||
# Memory check
|
||||
try:
|
||||
|
@ -385,7 +385,7 @@ def get_devices():
|
||||
}
|
||||
|
||||
def get_device_info(device):
|
||||
if not device_manager.is_cuda_available():
|
||||
if device in ("cpu", "mps"):
|
||||
return {"name": device_manager.get_processor_name()}
|
||||
|
||||
mem_free, mem_total = torch.cuda.mem_get_info(device)
|
||||
|
Loading…
Reference in New Issue
Block a user