From 8ab6b4b69783661fd4f139b6de93465a22127642 Mon Sep 17 00:00:00 2001 From: doctorpangloss <@hiddenswitch.com> Date: Mon, 5 Aug 2024 17:20:28 -0700 Subject: [PATCH] Fix running on CPU again --- comfy/model_management.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 8093d495d..7e55af993 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -1034,9 +1034,16 @@ def should_use_bf16(device=None, model_params=0, prioritize_performance=True, ma if is_intel_xpu(): return True - props = torch.cuda.get_device_properties("cuda") - if props.major >= 8: - return True + if device is None: + device = torch.device("cuda") + + try: + props = torch.cuda.get_device_properties(device) + if props.major >= 8: + return True + except AssertionError: + logging.warning("Torch was not compiled with CUDA support") + return False bf16_works = torch.cuda.is_bf16_supported()