Hermes Bot commited on
Commit ·
55e1756
1
Parent(s): e327a4a
Override should_use_bf16 to avoid CUDA calls
Browse files
comfy_integration/__pycache__/setup.cpython-311.pyc
CHANGED
|
Binary files a/comfy_integration/__pycache__/setup.cpython-311.pyc and b/comfy_integration/__pycache__/setup.cpython-311.pyc differ
|
|
|
comfy_integration/setup.py
CHANGED
|
@@ -86,6 +86,19 @@ def initialize_comfyui():
|
|
| 86 |
# Ensure torch treats CUDA as unavailable on CPU‑only environment.
|
| 87 |
import torch
|
| 88 |
torch.cuda.is_available = lambda: False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
# Apply patch to the external ComfyUI model_management before import.
|
| 91 |
external_model_mgmt_path = os.path.join(APP_DIR, "comfy", "model_management.py")
|
|
@@ -158,8 +171,13 @@ def initialize_comfyui():
|
|
| 158 |
model_mgmt.get_torch_device = _cpu_fallback_get_torch_device
|
| 159 |
import importlib
|
| 160 |
importlib.reload(model_mgmt)
|
| 161 |
-
|
| 162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
|
| 164 |
print("✅ ComfyUI initialized with default attention mechanism.")
|
| 165 |
|
|
|
|
| 86 |
# Ensure torch treats CUDA as unavailable on CPU‑only environment.
|
| 87 |
import torch
|
| 88 |
torch.cuda.is_available = lambda: False
|
| 89 |
+
+ # Additional CUDA stubs to prevent calls like torch.cuda.get_device_properties
|
| 90 |
+
+ class _DummyDeviceProps:
|
| 91 |
+
+ def __init__(self):
|
| 92 |
+
+ self.major = 0
|
| 93 |
+
+ self.minor = 0
|
| 94 |
+
+ self.total_memory = 0
|
| 95 |
+
+ def _dummy_get_device_properties(device):
|
| 96 |
+
+ return _DummyDeviceProps()
|
| 97 |
+
+ torch.cuda.get_device_properties = _dummy_get_device_properties
|
| 98 |
+
+ torch.cuda.device_count = lambda: 0
|
| 99 |
+
+ torch.cuda.current_device = lambda: 0
|
| 100 |
+
+ torch.cuda.get_device_name = lambda device: "cpu"
|
| 101 |
+
|
| 102 |
|
| 103 |
# Apply patch to the external ComfyUI model_management before import.
|
| 104 |
external_model_mgmt_path = os.path.join(APP_DIR, "comfy", "model_management.py")
|
|
|
|
| 171 |
model_mgmt.get_torch_device = _cpu_fallback_get_torch_device
|
| 172 |
import importlib
|
| 173 |
importlib.reload(model_mgmt)
|
| 174 |
+
+ # Override should_use_bf16 to avoid any CUDA device property queries on CPU‑only systems.
|
| 175 |
+
+ def _safe_should_use_bf16(device, model_params=None):
|
| 176 |
+
+ """Return False unconditionally – no BF16 support on CPU‑only environment."""
|
| 177 |
+
+ return False
|
| 178 |
+
+ model_mgmt.should_use_bf16 = _safe_should_use_bf16
|
| 179 |
+
|
| 180 |
+
print("--- Environment Ready ---")
|
| 181 |
|
| 182 |
print("✅ ComfyUI initialized with default attention mechanism.")
|
| 183 |
|