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()