From 5912141732d913173622391b2b7fb9386e278290 Mon Sep 17 00:00:00 2001 From: Maksym Solomyanov Date: Tue, 14 Oct 2025 13:28:27 +0200 Subject: [PATCH 1/3] Update distorch_2.py: Add compatibility for GGUFModelPatcher and ModelPatcher lacking model_patches_models attribute Some model patchers define only model_patches_to() and not model_patches_models(), which ComfyUI expects for dependency discovery. This patch adds a targeted fallback for GGUFModelPatcher and ModelPatcher to prevent AttributeError when model_patches_models() is missing. --- distorch_2.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/distorch_2.py b/distorch_2.py index f1bf931..b966528 100644 --- a/distorch_2.py +++ b/distorch_2.py @@ -51,6 +51,21 @@ def register_patched_safetensor_modelpatcher(): models_temp = set() for m in models: models_temp.add(m) + model_type = type(m).__name__ + + if ("GGUF" in model_type or "ModelPatcher" in model_type) and hasattr(m, "model_patches_to"): + print(f"[MultiGPU] {type(m).__name__} missing 'model_patches_models' attribute, using 'model_patches_to' fallback.") + target_device = getattr(m, "load_device", + f"cuda:{torch.cuda.current_device()}" if torch.cuda.is_available() else "cpu") + print(f"Target device: {target_device}") + patches = m.model_patches_to(target_device) + if patches: + print(f"[MultiGPU] Found {len(patches)} mm_patch(es) for {type(m).__name__} on device {target_device}") + for mm_patch in patches: + print(f"[MultiGPU] Registering mm_patch: {type(mm_patch).__name__}") + models_temp.add(mm_patch) + continue + for mm_patch in m.model_patches_models(): models_temp.add(mm_patch) patches = m.model_patches_to(m.load_device) From fa437d2dc34629d8025288d94353b53072db996b Mon Sep 17 00:00:00 2001 From: John Pollock Date: Tue, 14 Oct 2025 13:49:16 -0500 Subject: [PATCH 2/3] Updating distorch_2.py: 1. Replacing ad-hoc print() with structured logging 2. Simplifying device detection (fail-fast approach) 3. Maintaining the implemented backward compatibility for GGUF/ModelPatcher by max-solo23 4. Following the repository's logging conventions Co-authored-by: max-solo23 --- distorch_2.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/distorch_2.py b/distorch_2.py index b966528..1922875 100644 --- a/distorch_2.py +++ b/distorch_2.py @@ -54,15 +54,14 @@ def register_patched_safetensor_modelpatcher(): model_type = type(m).__name__ if ("GGUF" in model_type or "ModelPatcher" in model_type) and hasattr(m, "model_patches_to"): - print(f"[MultiGPU] {type(m).__name__} missing 'model_patches_models' attribute, using 'model_patches_to' fallback.") - target_device = getattr(m, "load_device", - f"cuda:{torch.cuda.current_device()}" if torch.cuda.is_available() else "cpu") - print(f"Target device: {target_device}") + logger.info(f"[MultiGPU DisTorch V2] {type(m).__name__} missing 'model_patches_models' attribute, using 'model_patches_to' fallback.") + target_device = m.load_device + logger.debug(f"[MultiGPU DisTorch V2] Target device: {target_device}") patches = m.model_patches_to(target_device) if patches: - print(f"[MultiGPU] Found {len(patches)} mm_patch(es) for {type(m).__name__} on device {target_device}") + logger.debug(f"[MultiGPU DisTorch V2] Found {len(patches)} mm_patch(es) for {type(m).__name__} on device {target_device}") for mm_patch in patches: - print(f"[MultiGPU] Registering mm_patch: {type(mm_patch).__name__}") + logger.debug(f"[MultiGPU DisTorch V2] Registering mm_patch: {type(mm_patch).__name__}") models_temp.add(mm_patch) continue From 0473c2a72a9e56f4470407a014b78693b45ddeaa Mon Sep 17 00:00:00 2001 From: John Pollock Date: Tue, 14 Oct 2025 13:57:25 -0500 Subject: [PATCH 3/3] PR #128 - Improving GGUF model compatibility with DisTorch2 - Bump revision to 2.5.8 Co-authored-by: max-solo23 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c8df6f2..1fc9b2b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-multigpu" description = "Provides a suite of custom nodes to manage multiple GPUs for ComfyUI, including advanced model offloading for both GGUF and Safetensor formats with DisTorch, and bespoke MultiGPU support for WanVideoWrapper and other custom nodes." -version = "2.5.7" +version = "2.5.8" license = {file = "LICENSE"} [project.urls]