From e81f33508b0821ea2f53f4f46a833fa6215626bd Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Fri, 19 Sep 2025 02:05:04 +0300 Subject: [PATCH] more robust GGUF node detection --- nodes/model_optimization_nodes.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/nodes/model_optimization_nodes.py b/nodes/model_optimization_nodes.py index b43abe1..831a299 100644 --- a/nodes/model_optimization_nodes.py +++ b/nodes/model_optimization_nodes.py @@ -1,3 +1,4 @@ +import os from comfy.ldm.modules import attention as comfy_attention import logging import comfy.model_patcher @@ -1963,15 +1964,20 @@ if v3_available: @classmethod def _get_gguf_module(cls): - """Lazy import of GGUF module with fallback options""" - try: - return importlib.import_module("ComfyUI-GGUF") - except ImportError: + gguf_path = os.path.join(folder_paths.folder_names_and_paths["custom_nodes"][0][0], "ComfyUI-GGUF") + """Import GGUF module with version validation""" + for module_name in ["ComfyUI-GGUF", "custom_nodes.ComfyUI-GGUF", "comfyui-gguf", "custom_nodes.comfyui-gguf", gguf_path, gguf_path.lower()]: try: - return importlib.import_module("comfyui-gguf") + module = importlib.import_module(module_name) + return module except ImportError: - raise ImportError("This node requires ComfyUI-GGUF to be installed.") - + continue + + raise ImportError( + "Compatible ComfyUI-GGUF not found. " + "Please install/update from: https://github.com/city96/ComfyUI-GGUF" + ) + @classmethod def execute(cls, model_name, extra_model_name, dequant_dtype, patch_dtype, patch_on_device, attention_override, enable_fp16_accumulation):