Hermes Bot commited on
Commit
4071aca
·
1 Parent(s): c192821

Fix syntax errors and ensure CPU fallback in model_management; make SageAttention patch robust

Browse files
__pycache__/app.cpython-311.pyc ADDED
Binary file (6.57 kB). View file
 
app.py CHANGED
@@ -22,16 +22,17 @@ def apply_sage_attention_patch():
22
  try:
23
  from comfy import model_management
24
  import sageattention
25
-
26
  print("--- [Runtime Patch] sageattention package found. Applying patch... ---")
27
- model_management.sage_attention_enabled = lambda: True
28
- model_management.pytorch_attention_enabled = lambda: False
29
-
 
 
30
  SAGE_PATCH_APPLIED = True
31
  return "✅ Successfully enabled SageAttention."
32
- except ImportError:
33
  SAGE_PATCH_APPLIED = False
34
- msg = "--- [Runtime Patch] ⚠️ sageattention package not found. Continuing with default attention. ---"
35
  print(msg)
36
  return msg
37
  except Exception as e:
 
22
  try:
23
  from comfy import model_management
24
  import sageattention
 
25
  print("--- [Runtime Patch] sageattention package found. Applying patch... ---")
26
+ # Safely set flags if they exist; on CPU-only setups model_management may be limited.
27
+ if hasattr(model_management, "sage_attention_enabled"):
28
+ model_management.sage_attention_enabled = lambda: True
29
+ if hasattr(model_management, "pytorch_attention_enabled"):
30
+ model_management.pytorch_attention_enabled = lambda: False
31
  SAGE_PATCH_APPLIED = True
32
  return "✅ Successfully enabled SageAttention."
33
+ except Exception as e:
34
  SAGE_PATCH_APPLIED = False
35
+ msg = f"--- [Runtime Patch] ⚠️ SageAttention patch could not be applied: {e} ---"
36
  print(msg)
37
  return msg
38
  except Exception as e:
comfy_integration/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (159 Bytes). View file
 
comfy_integration/__pycache__/setup.cpython-311.pyc ADDED
Binary file (6.76 kB). View file
 
core/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (146 Bytes). View file
 
core/__pycache__/settings.cpython-311.pyc ADDED
Binary file (11.5 kB). View file
 
utils/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (147 Bytes). View file
 
utils/__pycache__/app_utils.cpython-311.pyc ADDED
Binary file (37.1 kB). View file