The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Small refactor of is_device_* functions.
comfyanonymousaeaeca10bd7c
diff --git a/comfy/model_management.py b/comfy/model_management.pyindex a8dc91b9e..0b3f6ead6 100644--- a/comfy/model_management.py+++ b/comfy/model_management.py@@ -684,17 +684,20 @@ def mps_mode():global cpu_statereturn cpu_state == CPUState.MPS-def is_device_cpu(device):+def is_device_type(device, type):if hasattr(device, 'type'):- if (device.type == 'cpu'):+ if (device.type == type):return Truereturn False+def is_device_cpu(device):+ return is_device_type(device, 'cpu')+def is_device_mps(device):- if hasattr(device, 'type'):- if (device.type == 'mps'):- return True- return False+ return is_device_type(device, 'mps')++def is_device_cuda(device):+ return is_device_type(device, 'cuda')def should_use_fp16(device=None, model_params=0, prioritize_performance=True, manual_cast=False):global directml_enabled