ComfyUI-MultiGPU icon indicating copy to clipboard operation
ComfyUI-MultiGPU copied to clipboard

Error: too many values to unpack (expected 4)

Open doogyhatts opened this issue 1 year ago • 38 comments

I had encountered an error.

Traceback (most recent call last): File "/home/ComfyUI/execution.py", line 510, in execute output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/execution.py", line 324, in get_output_data return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/execution.py", line 298, in _async_map_node_over_list await process_inputs(input_dict, i) File "/home/ComfyUI/execution.py", line 286, in process_inputs result = f(**inputs) ^^^^^^^^^^^ File "/home/ComfyUI/nodes.py", line 1525, in sample return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/nodes.py", line 1492, in common_ksampler samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/comfy/sample.py", line 60, in sample samples = sampler.sample(noise, positive, negative, cfg=cfg, latent_image=latent_image, start_step=start_step, last_step=last_step, force_full_denoise=force_full_denoise, denoise_mask=noise_mask, sigmas=sigmas, callback=callback, disable_pbar=disable_pbar, seed=seed) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/custom_nodes/ComfyUI-TiledDiffusion/utils.py", line 51, in KSampler_sample return orig_fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/comfy/samplers.py", line 1163, in sample return sample(self.model, noise, positive, negative, cfg, self.device, sampler, sigmas, self.model_options, latent_image=latent_image, denoise_mask=denoise_mask, callback=callback, disable_pbar=disable_pbar, seed=seed) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/comfy/samplers.py", line 1053, in sample return cfg_guider.sample(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/comfy/samplers.py", line 1035, in sample output = executor.execute(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed, latent_shapes=latent_shapes) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/comfy/patcher_extension.py", line 112, in execute return self.original(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/comfy/samplers.py", line 984, in outer_sample self.inner_model, self.conds, self.loaded_models = comfy.sampler_helpers.prepare_sampling(self.model_patcher, noise.shape, self.conds, self.model_options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/comfy/sampler_helpers.py", line 130, in prepare_sampling return executor.execute(model, noise_shape, conds, model_options=model_options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/comfy/patcher_extension.py", line 112, in execute return self.original(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/comfy/sampler_helpers.py", line 138, in _prepare_sampling comfy.model_management.load_models_gpu([model] + models, memory_required=memory_required + inference_memory, minimum_memory_required=minimum_memory_required + inference_memory) File "/home/ComfyUI/custom_nodes/comfyui-multigpu/distorch_2.py", line 197, in patched_load_models_gpu loaded_model.model_load(lowvram_model_memory, force_patch_weights=force_patch_weights) File "/home/ComfyUI/comfy/model_management.py", line 506, in model_load self.model_use_more_vram(use_more_vram, force_patch_weights=force_patch_weights) File "/home/ComfyUI/comfy/model_management.py", line 536, in model_use_more_vram return self.model.partially_load(self.device, extra_memory, force_patch_weights=force_patch_weights) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/custom_nodes/comfyui-multigpu/distorch_2.py", line 239, in new_partially_load device_assignments = analyze_safetensor_loading(self, allocations, is_clip=is_clip_model) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/custom_nodes/comfyui-multigpu/distorch_2.py", line 426, in analyze_safetensor_loading total_memory = sum(module_size for module_size, _, _, _ in raw_block_list) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ComfyUI/custom_nodes/comfyui-multigpu/distorch_2.py", line 426, in total_memory = sum(module_size for module_size, _, _, _ in raw_block_list) ^^^^^^^^^^^^^^^^^^^^ ValueError: too many values to unpack (expected 4)

doogyhatts avatar Nov 27 '25 15:11 doogyhatts

me too, since last update of comfyui to newest version, i also deleted and reinstalled this node to version 2.5.10. as soon as i start nunchaku workflow it pop out the error on the text encoder (TextEncodeQwenImageEditPlus) after executed this node "CLIPLoaderGGUFDisTorch2MultiGPU", yesterday before the update everything worked.

here is the cli error msg:

[MultiGPU Core Patching] Successfully patched ModelPatcher.partially_load
gguf qtypes: Q6_K (1), F32 (141), Q5_K (197)
Dequantizing token_embd.weight to prevent runtime OOM.
Attenpting to find mmproj file for text encoder...
Using mmproj 'Qwen2.5-VL-7B-Instruct-mmproj-F16.gguf' for text encoder 'Qwen2.5-VL-7B-Instruct-Q5_K_S.gguf'.
gguf qtypes: F32 (291), F16 (228)
[MultiGPU Core Patching] text_encoder_device_patched returning device: cuda:0 (current_text_encoder_device=cuda:0)
CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cpu, dtype: torch.float16
[MultiGPU DisTorch V2] Full allocation string: #cuda:0;11.0;cuda:0
[MultiGPU DisTorch V2] ModelPatcher missing 'model_patches_models' attribute, using 'model_patches_to' fallback.
0 models unloaded.
loaded partially; 128.00 MB usable, 120.41 MB loaded, 121.60 MB offloaded, 7.59 MB buffer reserved, lowvram patches: 0
[MultiGPU DisTorch V2] GGUFModelPatcher missing 'model_patches_models' attribute, using 'model_patches_to' fallback.
Requested to load QwenImageTEModel_
===============================================
    DisTorch2 Model Virtual VRAM Analysis
===============================================
Object   Role   Original(GB) Total(GB)  Virt(GB)
-----------------------------------------------
cuda:0   recip      12.00GB   23.00GB  +11.00GB
cuda:0   donor      12.00GB    1.00GB  -11.00GB
-----------------------------------------------
model    model       6.46GB    0.00GB  -11.00GB
==================================================
[MultiGPU DisTorch V2] Final Allocation String:
cuda:0,0.0000;cuda:0,0.9167;cpu,0.0
==================================================
    DisTorch2 Model Device Allocations
==================================================
Device    VRAM GB    Dev %   Model GB    Dist %
--------------------------------------------------
cuda:0      12.00    91.7%      11.00    100.0%
cpu         63.93     0.0%       0.00      0.0%
--------------------------------------------------
!!! Exception during processing !!! too many values to unpack (expected 4)
Traceback (most recent call last):
  File "H:\Comfyui\ComfyUI\execution.py", line 510, in execute
    output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs)
                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "H:\Comfyui\ComfyUI\execution.py", line 324, in get_output_data
    return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "H:\Comfyui\ComfyUI\execution.py", line 298, in _async_map_node_over_list
    await process_inputs(input_dict, i)
  File "H:\Comfyui\ComfyUI\execution.py", line 286, in process_inputs
    result = f(**inputs)
             ^^^^^^^^^^^
  File "H:\Comfyui\ComfyUI\comfy_api\internal\__init__.py", line 149, in wrapped_func
    return method(locked_class, **inputs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "H:\Comfyui\ComfyUI\comfy_api\latest\_io.py", line 1275, in EXECUTE_NORMALIZED
    to_return = cls.execute(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "H:\Comfyui\ComfyUI\comfy_extras\nodes_qwen.py", line 101, in execute
    conditioning = clip.encode_from_tokens_scheduled(tokens)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "H:\Comfyui\ComfyUI\comfy\sd.py", line 178, in encode_from_tokens_scheduled
    pooled_dict = self.encode_from_tokens(tokens, return_pooled=return_pooled, return_dict=True)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "H:\Comfyui\ComfyUI\comfy\sd.py", line 239, in encode_from_tokens
    self.load_model()
  File "H:\Comfyui\ComfyUI\comfy\sd.py", line 272, in load_model
    model_management.load_model_gpu(self.patcher)
  File "H:\Comfyui\ComfyUI\comfy\model_management.py", line 706, in load_model_gpu
    return load_models_gpu([model])
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "H:\Comfyui\ComfyUI\custom_nodes\comfyui-multigpu\distorch_2.py", line 197, in patched_load_models_gpu
    loaded_model.model_load(lowvram_model_memory, force_patch_weights=force_patch_weights)
  File "H:\Comfyui\ComfyUI\comfy\model_management.py", line 506, in model_load
    self.model_use_more_vram(use_more_vram, force_patch_weights=force_patch_weights)
  File "H:\Comfyui\ComfyUI\comfy\model_management.py", line 536, in model_use_more_vram
    return self.model.partially_load(self.device, extra_memory, force_patch_weights=force_patch_weights)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "H:\Comfyui\ComfyUI\custom_nodes\comfyui-multigpu\distorch_2.py", line 239, in new_partially_load
    device_assignments = analyze_safetensor_loading(self, allocations, is_clip=is_clip_model)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "H:\Comfyui\ComfyUI\custom_nodes\comfyui-multigpu\distorch_2.py", line 426, in analyze_safetensor_loading
    total_memory = sum(module_size for module_size, _, _, _ in raw_block_list)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "H:\Comfyui\ComfyUI\custom_nodes\comfyui-multigpu\distorch_2.py", line 426, in <genexpr>
    total_memory = sum(module_size for module_size, _, _, _ in raw_block_list)
                                       ^^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 4)

JaneDoe84 avatar Nov 27 '25 17:11 JaneDoe84

Same. Since last ComfyUI update distorch nodes don't work anymore.

Norne9 avatar Nov 28 '25 02:11 Norne9

Same here. Stumbled upon this after latest update

EDIT: Okay fixed this myself. https://pastebin.com/UXNyxFR1

Problem was with changed _load_list from model_patcher.py, because it now has 5 params when distorch_2.py expects 4, so I changed calls accordingly and now everything works.

I hope pollockjj will update his code also to account for this changes

katzsmile avatar Nov 28 '25 10:11 katzsmile

Same here. Stumbled upon this after latest update

EDIT: Okay fixed this myself. https://pastebin.com/UXNyxFR1

Problem was with changed _load_list from model_patcher.py, because it now has 5 params when distorch_2.py expects 4, so I changed calls accordingly and now everything works.

I hope pollockjj will update his code also to account for this changes

Thanks for this fix. It worked out great. I'm busy with a series of tutorials which use these nodes and I'd like to make installation as easy as possible for viewers. Would it be OK if I added your fix to a fork of MultiGPU nodes and give you credit?

Fossiel avatar Nov 29 '25 11:11 Fossiel

It appears that this is not yet a complete fix. The WAN example works with the fix, but the Qwen Image example is broken at the CLIP encoder

2025-11-30T00:03:04.476451 - [MultiGPU DisTorch V2] ModelPatcher missing 'model_patches_models' attribute, using 'model_patches_to' fallback.
2025-11-30T00:03:04.476530 - Requested to load WanVAE
2025-11-30T00:03:04.975240 - 0 models unloaded.
2025-11-30T00:03:05.005535 - loaded partially; 128.00 MB usable, 105.22 MB loaded, 136.78 MB offloaded, 22.78 MB buffer reserved, lowvram patches: 0
2025-11-30T00:03:06.102578 - Prompt executed in 114.42 seconds
2025-11-30T00:03:20.424766 - got prompt
2025-11-30T00:03:20.729395 - Using pytorch attention in VAE
2025-11-30T00:03:20.729847 - Using pytorch attention in VAE
2025-11-30T00:03:20.779369 - VAE load device: cuda:1, offload device: cpu, dtype: torch.bfloat16
2025-11-30T00:03:20.795255 - [MultiGPU Core Patching] text_encoder_device_patched returning device: cuda:1 (current_text_encoder_device=cuda:1)
2025-11-30T00:03:20.795597 - Using scaled fp8: fp8 matrix mult: False, scale input: False
2025-11-30T00:03:20.884797 - CLIP/text encoder model load device: cuda:1, offload device: cpu, current: cpu, dtype: torch.float16
2025-11-30T00:03:21.549416 - [MultiGPU DisTorch V2] Full allocation string: #cuda:1;3.9;cpu
2025-11-30T00:03:21.550892 - [MultiGPU DisTorch V2] ModelPatcher missing 'model_patches_models' attribute, using 'model_patches_to' fallback.
2025-11-30T00:03:21.550926 - Requested to load QwenImageTEModel_
2025-11-30T00:03:21.553880 - ===============================================
2025-11-30T00:03:21.553905 -     DisTorch2 Model Virtual VRAM Analysis
2025-11-30T00:03:21.553921 - ===============================================
2025-11-30T00:03:21.553938 - Object   Role   Original(GB) Total(GB)  Virt(GB)
2025-11-30T00:03:21.553953 - -----------------------------------------------
2025-11-30T00:03:21.554032 - cuda:1   recip      23.56GB   27.46GB   +3.90GB
2025-11-30T00:03:21.554080 - cpu      donor     123.37GB  119.47GB   -3.90GB
2025-11-30T00:03:21.554096 - -----------------------------------------------
2025-11-30T00:03:21.554997 - model    model       7.72GB    3.82GB   -3.90GB
2025-11-30T00:03:21.555034 - ==================================================
2025-11-30T00:03:21.555058 - [MultiGPU DisTorch V2] Final Allocation String:
cuda:1,0.1623;cpu,0.0316;cuda:0,0.0
2025-11-30T00:03:21.555289 - ==================================================
2025-11-30T00:03:21.555311 -     DisTorch2 Model Device Allocations
2025-11-30T00:03:21.555328 - ==================================================
2025-11-30T00:03:21.555344 - Device    VRAM GB    Dev %   Model GB    Dist %
2025-11-30T00:03:21.555358 - --------------------------------------------------
2025-11-30T00:03:21.555380 - cuda:0      23.55     0.0%       0.00      0.0%
2025-11-30T00:03:21.555394 - cuda:1      23.56    16.2%       3.82     49.5%
2025-11-30T00:03:21.555409 - cpu        123.37     3.2%       3.90     50.5%
2025-11-30T00:03:21.555422 - --------------------------------------------------
2025-11-30T00:03:21.563343 - [MultiGPU DisTorch V2 CLIP] Preserving 2 head layer(s) (1042.37 MB) on compute device: cuda:1
2025-11-30T00:03:21.563485 - !!! Exception during processing !!! not enough values to unpack (expected 5, got 4)
2025-11-30T00:03:21.564424 - Traceback (most recent call last):
  File "/mnt/Nova/Apps/comfy/execution.py", line 510, in execute
    output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs)
                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/Nova/Apps/comfy/execution.py", line 324, in get_output_data
    return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/Nova/Apps/comfy/execution.py", line 298, in _async_map_node_over_list
    await process_inputs(input_dict, i)
  File "/mnt/Nova/Apps/comfy/execution.py", line 286, in process_inputs
    result = f(**inputs)
  File "/mnt/Nova/Apps/comfy/nodes.py", line 74, in encode
    return (clip.encode_from_tokens_scheduled(tokens), )
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/mnt/Nova/Apps/comfy/comfy/sd.py", line 180, in encode_from_tokens_scheduled
    pooled_dict = self.encode_from_tokens(tokens, return_pooled=return_pooled, return_dict=True)
  File "/mnt/Nova/Apps/comfy/comfy/sd.py", line 241, in encode_from_tokens
    self.load_model()
    ~~~~~~~~~~~~~~~^^
  File "/mnt/Nova/Apps/comfy/comfy/sd.py", line 274, in load_model
    model_management.load_model_gpu(self.patcher)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/mnt/Nova/Apps/comfy/comfy/model_management.py", line 706, in load_model_gpu
    return load_models_gpu([model])
  File "/mnt/Nova/Apps/comfy/custom_nodes/comfyui-multigpu/distorch_2.py", line 197, in patched_load_models_gpu
    loaded_model.model_load(lowvram_model_memory, force_patch_weights=force_patch_weights)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/Nova/Apps/comfy/comfy/model_management.py", line 506, in model_load
    self.model_use_more_vram(use_more_vram, force_patch_weights=force_patch_weights)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/Nova/Apps/comfy/comfy/model_management.py", line 536, in model_use_more_vram
    return self.model.partially_load(self.device, extra_memory, force_patch_weights=force_patch_weights)
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/Nova/Apps/comfy/custom_nodes/comfyui-multigpu/distorch_2.py", line 239, in new_partially_load
    device_assignments = analyze_safetensor_loading(self, allocations, is_clip=is_clip_model)
  File "/mnt/Nova/Apps/comfy/custom_nodes/comfyui-multigpu/distorch_2.py", line 453, in analyze_safetensor_loading
    for module_offload_mem, module_size, module_name, module_object, params in distributable_raw:
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 5, got 4)

Mithrillion avatar Nov 29 '25 13:11 Mithrillion

Thanks for this fix. It worked out great. I'm busy with a series of tutorials which use these nodes and I'd like to make installation as easy as possible for viewers. Would it be OK if I added your fix to a fork of MultiGPU nodes and give you credit?

You can do whatever you want with this, I dont mind. It is just a quick hack.

It appears that this is not yet a complete fix. The WAN example works with the fix, but the Qwen Image example is broken at the CLIP encoder

Hmm, cant reproduce this bug, tested with Qwen-Image myself without any problem. Did you try to update a ComfyUI to the latest?

katzsmile avatar Nov 29 '25 13:11 katzsmile

Same here. Stumbled upon this after latest update

EDIT: Okay fixed this myself. https://pastebin.com/UXNyxFR1

Problem was with changed _load_list from model_patcher.py, because it now has 5 params when distorch_2.py expects 4, so I changed calls accordingly and now everything works.

I hope pollockjj will update his code also to account for this changes

thanks for this. works great.

maraan666 avatar Nov 29 '25 14:11 maraan666

It appears that this is not yet a complete fix. The WAN example works with the fix, but the Qwen Image example is broken at the CLIP encoder

I don't get an error with Qwen but an almost instant OOM. However, I've tested the old version that worked and it functions perfectly with Qwen as before. I have renamed all the nodes to prevent conflicts and now I'm running them alongside each other. I'll be uploading the renamed fork to my github page tonight.

You can do whatever you want with this, I dont mind. It is just a quick hack.

Thank you very much. I will credit you.

Fossiel avatar Nov 29 '25 15:11 Fossiel

Building on @katzsmile's fix - I found 7 spots that need patching (including line 453 that broke @Mithrillion's Qwen workflow). Locations to change for module_size, ... → for _, module_size, ...: Lines 245, 324, 444, 453 Sum comprehensions: Lines 426, 584, 643 Output tuples (add leading 0): Lines 326, 330 Tested with Flux 2.dev split across 4x RTX 3090s - works great with GGUF models. (Heads up: FP8 models produce NaN when split, stick to GGUF for multi-GPU.) Happy to submit a PR with the full diff if that helps!

dogelyfe avatar Dec 01 '25 23:12 dogelyfe

Same here. Stumbled upon this after latest update

EDIT: Okay fixed this myself. https://pastebin.com/UXNyxFR1

Problem was with changed _load_list from model_patcher.py, because it now has 5 params when distorch_2.py expects 4, so I changed calls accordingly and now everything works.

I hope pollockjj will update his code also to account for this changes

Not works for me. I've changed distorch_2 on yours but got the same error

RuslanKuz avatar Dec 02 '25 11:12 RuslanKuz

It seems to be a problem with the distorch1 and 2 cliploaders, at least for me. When using the simpler 'CLIPLoaderMultiGPU' or 'CLIPLoaderGGUFMultiGPU' node this error goes away. At least for me with wan 2.2.

This all started for me with the nightly ComfyUI v0.3.75 and v0.3.76.

Rumaben avatar Dec 02 '25 11:12 Rumaben

Same here. Stumbled upon this after latest update EDIT: Okay fixed this myself. https://pastebin.com/UXNyxFR1 Problem was with changed _load_list from model_patcher.py, because it now has 5 params when distorch_2.py expects 4, so I changed calls accordingly and now everything works. I hope pollockjj will update his code also to account for this changes

thanks for this. works great.

It works, fine, just look for the line 426, and replace it with: total_memory = sum(module_size for module_size, _, _, _, _ in raw_block_list) Cheers!

IL3DCR avatar Dec 02 '25 23:12 IL3DCR

I changed the line and it does not work somehow. raw_block_list = model_patcher._load_list() #total_memory = sum(module_size for module_size, _, _, _ in raw_block_list) total_memory = sum(module_size for module_size, _, _, _, _ in raw_block_list)

MavenDE avatar Dec 03 '25 13:12 MavenDE

total_memory = sum(module_size for module_size, _, _, _, _ in raw_block_list)

Because it should be this:

total_memory = sum(module_size for _, module_size, _, _, _ in raw_block_list)

katzsmile avatar Dec 03 '25 16:12 katzsmile

This pat

Same here. Stumbled upon this after latest update EDIT: Okay fixed this myself. https://pastebin.com/UXNyxFR1 Problem was with changed _load_list from model_patcher.py, because it now has 5 params when distorch_2.py expects 4, so I changed calls accordingly and now everything works. I hope pollockjj will update his code also to account for this changes

thanks for this. works great.

This was epic!

RamboRogers avatar Dec 03 '25 19:12 RamboRogers

Same here. Stumbled upon this after latest update EDIT: Okay fixed this myself. https://pastebin.com/UXNyxFR1 Problem was with changed _load_list from model_patcher.py, because it now has 5 params when distorch_2.py expects 4, so I changed calls accordingly and now everything works. I hope pollockjj will update his code also to account for this changes

Not works for me. I've changed distorch_2 on yours but got the same error

Same here I just get a slightly different error even after trying each of the suggested sentences at line number 426.

'not enough values to unpack (expected 5, got 4)'

Tried both the latest stable multigpu as well as the nightly version. I appreciate the work from everyone though. :) Thank you.

Rumaben avatar Dec 03 '25 21:12 Rumaben

This pat

Same here. Stumbled upon this after latest update EDIT: Okay fixed this myself. https://pastebin.com/UXNyxFR1 Problem was with changed _load_list from model_patcher.py, because it now has 5 params when distorch_2.py expects 4, so I changed calls accordingly and now everything works. I hope pollockjj will update his code also to account for this changes

thanks for this. works great.

This was epic!

It does not work at all. So what was epic?

MavenDE avatar Dec 04 '25 23:12 MavenDE

found the root cause Error on commit after: https://github.com/comfyanonymous/ComfyUI/pull/10733

Image

and

Work on commit before: c38e7d6599be1bdce580ccfdbb20b928315af05e Image

This change caused havoc in heavily modified custom loaders that still piggyback on the ComfyUI loader. My custom FSDP nodes also started throwing errors. I’m starting to think other custom node loaders are affected as well, and after searching for similar errors, it looks like they are.

komikndr avatar Dec 07 '25 14:12 komikndr

@komikndr Better to pass around a class or small dict, I think. Changing positions on a tuple... Does this parm even have any use outside this vram management thing they're working on?

Symbiomatrix avatar Dec 07 '25 18:12 Symbiomatrix

I am not familiar with Distorch, however if i may add, yes those parameters are for calculating the offload memory in ComfyUI. I don't know how intrusive Distorch to model loader in Comfy since the FSDP function in raylight is very intrusive that's it is equivalent to ripping out a heart out of person and replace it with another.

So my only way in my nodes, and it might be worth taking a look in Distorch, is to make a child of ModelPatcher. Say for example make a class DistorchModelPatcher(ModelPatcher)

and regress the def _load_list(self) and also for def load(self, device_to=None, lowvram_model_memory=0, force_patch_weights=False, full_load=False): to previous version of ComfyUI before using VRAM calculation

or maybe using ModelPatcher._load_list = types.MethodType(old_load_function, ModelPatcher) before loading the weight, and i think this might the best simplest option

or maybe there is a simpler solution.

Edit: After looking at comfy.model_patcher.ModelPatcher.partially_load = new_partially_load

Yeah the second solution is the way

komikndr avatar Dec 08 '25 02:12 komikndr