From 7b70b266d843150adffdb7262394e6b777e0d6ce Mon Sep 17 00:00:00 2001 From: David Date: Thu, 22 Aug 2024 12:24:21 -0500 Subject: [PATCH] Generalize MacOS version check for force-upcast-attention (#4548) This code automatically forces upcasting attention for MacOS versions 14.5 and 14.6. My computer returns the string "14.6.1" for `platform.mac_ver()[0]`, so this generalizes the comparison to catch more versions. I am running MacOS Sonoma 14.6.1 (latest version) and was seeing black image generation on previously functional workflows after recent software updates. This PR solved the issue for me. See comfyanonymous/ComfyUI#3521 --- comfy/model_management.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index a4174c6..ca7221f 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -884,7 +884,8 @@ def pytorch_attention_flash_attention(): def force_upcast_attention_dtype(): upcast = args.force_upcast_attention try: - if platform.mac_ver()[0] in ['14.5']: #black image bug on OSX Sonoma 14.5 + macos_version = tuple(int(n) for n in platform.mac_ver()[0].split(".")) + if (14, 5) <= macos_version < (14, 7): # black image bug on recent versions of MacOS upcast = True except: pass