From 15564688edb9252ffe0b4f284a814ef2cd546446 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 23 Dec 2024 03:22:48 -0500 Subject: [PATCH] Add a try except block so if torch version is weird it won't crash. --- comfy/model_management.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 244fa5c7..33891b92 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -224,8 +224,11 @@ if ENABLE_PYTORCH_ATTENTION: torch.backends.cuda.enable_flash_sdp(True) torch.backends.cuda.enable_mem_efficient_sdp(True) -if int(torch_version[0]) == 2 and int(torch_version[2]) >= 5: - torch.backends.cuda.allow_fp16_bf16_reduction_math_sdp(True) +try: + if int(torch_version[0]) == 2 and int(torch_version[2]) >= 5: + torch.backends.cuda.allow_fp16_bf16_reduction_math_sdp(True) +except: + logging.warning("Warning, could not set allow_fp16_bf16_reduction_math_sdp") if args.lowvram: set_vram_to = VRAMState.LOW_VRAM