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

[Bug] Sudden RuntimeError: shape mismatch with GGUF Models in WanVideoSampler

Open Mr-small-2-six opened this issue 2 months ago • 2 comments

Hello, I've encountered a sudden issue with the WanVideoSampler node when using GGUF models. My workflow, which was previously working perfectly with the exact same models, nodes, and settings, has started to fail with a RuntimeError. The error seems to be isolated to workflows involving GGUF models, as other setups are still working correctly. It appears to be a regression, but I'm not sure if it's caused by a recent update to ComfyUI, this custom node, or another dependency. Error Details Node ID: 26 Node Type: WanVideoSampler Exception Type: RuntimeError Exception Message: Expected weight to be of same shape as normalized_shape, but got weight of shape [5120] and normalized_shape = [2880] This indicates a tensor shape mismatch within the model's normalization layer, which is unexpected since this configuration was functional before. System Information ComfyUI Version: 0.3.68 Arguments: main.py --use-sage-attention --disable-smart-memory --base-directory F:\ComfyUI\13 --auto-launch --temp-directory F:\ComfyUI\13\ComfyUI\temp OS: Windows Python Version: 3.12.9 PyTorch Version: 2.8.0+cu129 GPU: NVIDIA GeForce RTX 4080

ComfyUI Error Report

Error Details

  • Node ID: 26
  • Node Type: WanVideoSampler
  • Exception Type: RuntimeError
  • Exception Message: Expected weight to be of same shape as normalized_shape, but got weight of shape [5120] and normalized_shape = [2880]

Stack Trace

  File "F:\ComfyUI\13\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 "F:\ComfyUI\13\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 "F:\ComfyUI\13\ComfyUI\execution.py", line 298, in _async_map_node_over_list
    await process_inputs(input_dict, i)

  File "F:\ComfyUI\13\ComfyUI\execution.py", line 286, in process_inputs
    result = f(**inputs)
             ^^^^^^^^^^^

  File "F:\ComfyUI\13\custom_nodes\ComfyUI-WanVideoWrapper\nodes_sampler.py", line 3071, in process
    raise e

  File "F:\ComfyUI\13\custom_nodes\ComfyUI-WanVideoWrapper\nodes_sampler.py", line 2953, in process
    noise_pred, noise_pred_ovi, self.cache_state = predict_with_cfg(
                                                   ^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\custom_nodes\ComfyUI-WanVideoWrapper\nodes_sampler.py", line 1563, in predict_with_cfg
    raise e

  File "F:\ComfyUI\13\custom_nodes\ComfyUI-WanVideoWrapper\nodes_sampler.py", line 1434, in predict_with_cfg
    noise_pred_cond, noise_pred_ovi, cache_state_cond = transformer(
                                                        ^^^^^^^^^^^^

  File "F:\ComfyUI\13\ComfyUI\venv\Lib\site-packages\torch\nn\modules\module.py", line 1773, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\ComfyUI\venv\Lib\site-packages\torch\nn\modules\module.py", line 1784, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\custom_nodes\ComfyUI-WanVideoWrapper\wanvideo\modules\model.py", line 2934, in forward
    x, x_ip, lynx_ref_feature, x_ovi = block(x, x_ip=x_ip, lynx_ref_feature=lynx_ref_feature, x_ovi=x_ovi, **kwargs) #run block
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\ComfyUI\venv\Lib\site-packages\torch\_dynamo\eval_frame.py", line 375, in __call__
    return super().__call__(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\ComfyUI\venv\Lib\site-packages\torch\nn\modules\module.py", line 1773, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\ComfyUI\venv\Lib\site-packages\torch\nn\modules\module.py", line 1784, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\ComfyUI\venv\Lib\site-packages\torch\_dynamo\eval_frame.py", line 736, in compile_wrapper
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\ComfyUI\venv\Lib\site-packages\torch\nn\modules\module.py", line 1773, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\ComfyUI\venv\Lib\site-packages\torch\nn\modules\module.py", line 1784, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\custom_nodes\ComfyUI-WanVideoWrapper\wanvideo\modules\model.py", line 1127, in forward
    q, k, v = self.self_attn.qkv_fn(input_x)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\custom_nodes\ComfyUI-WanVideoWrapper\wanvideo\modules\model.py", line 467, in qkv_fn
    q = self.norm_q(self.q(x).to(self.norm_q.weight.dtype)).to(x.dtype).view(b, s, n, d)

  File "F:\ComfyUI\13\custom_nodes\ComfyUI-WanVideoWrapper\wanvideo\modules\model.py", line 467, in torch_dynamo_resume_in_qkv_fn_at_467
    q = self.norm_q(self.q(x).to(self.norm_q.weight.dtype)).to(x.dtype).view(b, s, n, d)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\ComfyUI\venv\Lib\site-packages\torch\nn\modules\module.py", line 1773, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\ComfyUI\venv\Lib\site-packages\torch\nn\modules\module.py", line 1784, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\custom_nodes\ComfyUI-WanVideoWrapper\wanvideo\modules\model.py", line 389, in forward
    return super().forward(x)
           ^^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\ComfyUI\venv\Lib\site-packages\torch\nn\modules\normalization.py", line 402, in forward
    return F.rms_norm(x, self.normalized_shape, self.weight, self.eps)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "F:\ComfyUI\13\ComfyUI\venv\Lib\site-packages\torch\nn\functional.py", line 2924, in rms_norm
    return torch.rms_norm(input, normalized_shape, weight, eps)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

System Information

  • ComfyUI Version: 0.3.68
  • Arguments: main.py --use-sage-attention --disable-smart-memory --base-directory F:\ComfyUI\13 --auto-launch --temp-directory F:\ComfyUI\13\ComfyUI\temp
  • OS: nt
  • Python Version: 3.12.9 (tags/v3.12.9:fdb8142, Feb 4 2025, 15:27:58) [MSC v.1942 64 bit (AMD64)]
  • Embedded Python: false
  • PyTorch Version: 2.8.0+cu129

Devices

  • Name: cuda:0 NVIDIA GeForce RTX 4080 : cudaMallocAsync
    • Type: cuda
    • VRAM Total: 17170956288
    • VRAM Free: 15778971648
    • Torch VRAM Total: 0
    • Torch VRAM Free: 0

Mr-small-2-six avatar Nov 12 '25 11:11 Mr-small-2-six

Which model and workflow exactly?

kijai avatar Nov 12 '25 12:11 kijai

Which model and workflow exactly?

Wan2.2-Remix T2V GGUF Q4_k_m

workflow example_workflows i2v Changed some node to T2v

Mr-small-2-six avatar Nov 12 '25 17:11 Mr-small-2-six