Skip to content

Commit 0a0716b

Browse files
authored
Merge pull request #128 from max-solo23/patch-2
Fix AttributeError for patchers missing model_patches_models() (GGUFModelPatcher, ModelPatcher)
2 parents a24f0a6 + 0473c2a commit 0a0716b

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

distorch_2.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ def patched_load_models_gpu(models, memory_required=0, force_patch_weights=False
5151
models_temp = set()
5252
for m in models:
5353
models_temp.add(m)
54+
model_type = type(m).__name__
55+
56+
if ("GGUF" in model_type or "ModelPatcher" in model_type) and hasattr(m, "model_patches_to"):
57+
logger.info(f"[MultiGPU DisTorch V2] {type(m).__name__} missing 'model_patches_models' attribute, using 'model_patches_to' fallback.")
58+
target_device = m.load_device
59+
logger.debug(f"[MultiGPU DisTorch V2] Target device: {target_device}")
60+
patches = m.model_patches_to(target_device)
61+
if patches:
62+
logger.debug(f"[MultiGPU DisTorch V2] Found {len(patches)} mm_patch(es) for {type(m).__name__} on device {target_device}")
63+
for mm_patch in patches:
64+
logger.debug(f"[MultiGPU DisTorch V2] Registering mm_patch: {type(mm_patch).__name__}")
65+
models_temp.add(mm_patch)
66+
continue
67+
5468
for mm_patch in m.model_patches_models():
5569
models_temp.add(mm_patch)
5670
patches = m.model_patches_to(m.load_device)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "comfyui-multigpu"
33
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."
4-
version = "2.5.7"
4+
version = "2.5.8"
55
license = {file = "LICENSE"}
66

77
[project.urls]

0 commit comments

Comments
 (0)