← all conversations

Model dimension mismatch

2026-04-064 turns18,863 charsgpt-5-3
model-dimension-mismatchclip-modelcomfyui

Summary

User encountered a model dimension mismatch error in ComfyUI and asked if switching the clip model would resolve it.

Messages

RuntimeError: Given normalized_shape=[2560], expected input with shape [*2560], but got input of size[1, 98, 3584] File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/execution.py", line 534, 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, v3_data=v3_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/execution.py", line 334, 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, v3_data=v3_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/execution.py", line 308, in _async_map_node_over_list await process_inputs(input_dict, i) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/execution.py", line 296, in process_inputs result = f(**inputs) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/nodes.py", line 1591, in sample return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/nodes.py", line 1556, in common_ksampler samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise, disable_noise=disable_noise, start_step=start_step, last_step=last_step, force_full_denoise=force_full_denoise, noise_mask=noise_mask, callback=callback, disable_pbar=disable_pbar, seed=seed) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/sample.py", line 66, 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 "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/samplers.py", line 1180, 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 "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/samplers.py", line 1070, in sample return cfg_guider.sample(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/samplers.py", line 1052, in sample output = executor.execute(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed, latent_shapes=latent_shapes) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/patcher_extension.py", line 112, in execute return self.original(*args, **kwargs) ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/samplers.py", line 995, in outer_sample output = self.inner_sample(noise, latent_image, device, sampler, sigmas, denoise_mask, callback, disable_pbar, seed, latent_shapes=latent_shapes) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/samplers.py", line 981, in inner_sample samples = executor.execute(self, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/patcher_extension.py", line 112, in execute return self.original(*args, **kwargs) ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/samplers.py", line 751, in sample samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, **self.extra_options) File "/Users/danielkliewer/Documents/Projects/Comfy/venv/lib/python3.14/site-packages/torch/utils/_contextlib.py", line 124, in decorate_context return func(*args, **kwargs) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/k_diffusion/sampling.py", line 1435, in sample_res_multistep return res_multistep(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, s_noise=s_noise, noise_sampler=noise_sampler, eta=0., cfg_pp=False) File "/Users/danielkliewer/Documents/Projects/Comfy/venv/lib/python3.14/site-packages/torch/utils/_contextlib.py", line 124, in decorate_context return func(*args, **kwargs) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/k_diffusion/sampling.py", line 1393, in res_multistep denoised = model(x, sigmas[i] * s_in, **extra_args) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/samplers.py", line 400, in __call__ out = self.inner_model(x, sigma, model_options=model_options, seed=seed) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/samplers.py", line 954, in __call__ return self.outer_predict_noise(*args, **kwargs) ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/samplers.py", line 961, in outer_predict_noise ).execute(x, timestep, model_options, seed) ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/patcher_extension.py", line 112, in execute return self.original(*args, **kwargs) ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/samplers.py", line 964, in predict_noise return sampling_function(self.inner_model, x, timestep, self.conds.get("negative", None), self.conds.get("positive", None), self.cfg, model_options=model_options, seed=seed) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/samplers.py", line 380, in sampling_function out = calc_cond_batch(model, conds, x, timestep, model_options) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/samplers.py", line 205, in calc_cond_batch return _calc_cond_batch_outer(model, conds, x_in, timestep, model_options) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/samplers.py", line 213, in _calc_cond_batch_outer return executor.execute(model, conds, x_in, timestep, model_options) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/patcher_extension.py", line 112, in execute return self.original(*args, **kwargs) ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/samplers.py", line 325, in _calc_cond_batch output = model.apply_model(input_x, timestep_, **c).chunk(batch_chunks) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/model_base.py", line 172, in apply_model return comfy.patcher_extension.WrapperExecutor.new_class_executor( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ...<2 lines>... comfy.patcher_extension.get_all_wrappers(comfy.patcher_extension.WrappersMP.APPLY_MODEL, transformer_options) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ).execute(x, t, c_concat, c_crossattn, control, transformer_options, **kwargs) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/patcher_extension.py", line 112, in execute return self.original(*args, **kwargs) ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/model_base.py", line 211, in _apply_model model_output = self.diffusion_model(xc, t, context=context, control=control, transformer_options=transformer_options, **extra_conds) File "/Users/danielkliewer/Documents/Projects/Comfy/venv/lib/python3.14/site-packages/torch/nn/modules/module.py", line 1778, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/venv/lib/python3.14/site-packages/torch/nn/modules/module.py", line 1789, in _call_impl return forward_call(*args, **kwargs) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/ldm/lumina/model.py", line 804, in forward return comfy.patcher_extension.WrapperExecutor.new_class_executor( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ...<2 lines>... comfy.patcher_extension.get_all_wrappers(comfy.patcher_extension.WrappersMP.DIFFUSION_MODEL, kwargs.get("transformer_options", {})) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ).execute(x, timesteps, context, num_tokens, attention_mask, **kwargs) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/patcher_extension.py", line 112, in execute return self.original(*args, **kwargs) ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/ldm/lumina/model.py", line 841, in _forward img, mask, img_size, cap_size, freqs_cis, timestep_zero_index = self.patchify_and_embed(x, cap_feats, cap_mask, adaln_input, num_tokens, ref_latents=ref_latents, ref_contexts=ref_contexts, siglip_feats=siglip_feats, transformer_options=transformer_options) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/ldm/lumina/model.py", line 738, in patchify_and_embed out = self.embed_all(x, cap_feats, main_siglip, offset=start_t, omni=omni, transformer_options=transformer_options) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/ldm/lumina/model.py", line 660, in embed_all embeds, freqs_cis, cap_feats_len = self.embed_cap(cap_feats, offset=offset, bsz=bsz, device=device, dtype=x.dtype) ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/ldm/lumina/model.py", line 642, in embed_cap cap_feats = self.cap_embedder(cap_feats) File "/Users/danielkliewer/Documents/Projects/Comfy/venv/lib/python3.14/site-packages/torch/nn/modules/module.py", line 1778, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/venv/lib/python3.14/site-packages/torch/nn/modules/module.py", line 1789, in _call_impl return forward_call(*args, **kwargs) File "/Users/danielkliewer/Documents/Projects/Comfy/venv/lib/python3.14/site-packages/torch/nn/modules/container.py", line 253, in forward input = module(input) File "/Users/danielkliewer/Documents/Projects/Comfy/venv/lib/python3.14/site-packages/torch/nn/modules/module.py", line 1778, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/venv/lib/python3.14/site-packages/torch/nn/modules/module.py", line 1789, in _call_impl return forward_call(*args, **kwargs) File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/ops.py", line 516, in forward return self.forward_comfy_cast_weights(*args, **kwargs) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/Users/danielkliewer/Documents/Projects/Comfy/comfy/comfy/ops.py", line 509, in forward_comfy_cast_weights x = torch.nn.functional.rms_norm(input, self.normalized_shape, weight, self.eps) File "/Users/danielkliewer/Documents/Projects/Comfy/venv/lib/python3.14/site-packages/torch/nn/functional.py", line 2958, in rms_norm return torch.rms_norm(input, normalized_shape, weight, eps) ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This error is actually very precise—and it tells you exactly what’s broken once you decode it: > **`normalized_shape=[2560]` but input has last dim `3584`** ### What this means (in plain English) You’ve got a **model expecting embeddings of size 2560**, but it’s being fed **embeddings of size 3584**. That mismatch is happening here: ``` torch.rms_norm(input, normalized_shape=[2560]) ``` …but the tensor is: ``` [1, 98, 3584] ``` 👉 The last dimension (**3584**) must match **2560**, and it doesn’t. --- ## 🔥 Root Cause (specific to your stack) From your trace: - You're using **Lumina model (`ldm/lumina/model.py`)** - The failure happens in **`cap_embedder`** - That means: **text/caption embeddings don't match the model** ### So the mismatch is almost certainly: ### ❌ Wrong text encoder / CLIP / SigLIP / tokenizer paired with the model --- ## 🧠 What likely happened You mixed one of these: | Component | Expected | Actual | |----------|--------|--------| | Model | 2560 dim | ✔ | | Text encoder | 2560 dim | ❌ 3584 dim | | Or vice versa | ❌ | --- ## 💣 Common scenarios that cause THIS exact error ### 1. Mixing incompatible models - Example: - Lumina model trained with **SigLIP (2560)** - You plugged in **OpenCLIP / T5 / other encoder (3584)** --- ### 2. GGUF + non-matching pipeline You said earlier you're using **GGUF only (no diffusion model)** 👉 If: - GGUF model expects **one embedding size** - But ComfyUI pipeline injects another encoder 💥 Boom → this exact error --- ### 3. Wrong ComfyUI node wiring Especially: - `CLIP Text Encode` - `SigLIP` - `T5` - or custom nodes If one node outputs 3584 and the model expects 2560 → crash --- ## 🛠️ How to fix it (practical steps) ### ✅ Step 1 — Identify your model’s expected dim Check your model config or name: - **2560 → usually SigLIP / specific Lumina configs** - **3584 → often OpenCLIP / larger encoders** --- ### ✅ Step 2 — Match the encoder EXACTLY You must pair: ✔ Correct: - Model (2560) ↔ Encoder (2560) ❌ Wrong: - Model (2560) ↔ Encoder (3584) --- ### ✅ Step 3 — Fix in ComfyUI graph Look for nodes like: - `CLIP Loader` - `SigLIP Loader` - `Text Encode` 👉 Replace the encoder with the one that matches your model. --- ### ✅ Step 4 — If using GGUF-only pipeline You said: > "I am just using the gguf" Then this is critical: 👉 GGUF pipelines often: - **already include tokenizer/embedding expectations** - or expect a **specific external encoder** So: - Either use the **recommended encoder for that GGUF** - Or use a **workflow built specifically for that model** --- ## 🧪 Quick sanity test Print or inspect tensor shape before failure: ```python print(cap_feats.shape) ``` If you see: ``` [..., 3584] ``` but model expects: ``` 2560 ``` → confirmed mismatch --- ## 🧭 If you want a precise fix Send me: - Your **ComfyUI JSON workflow** - The **exact GGUF model name** - What **text encoder node** you're using I’ll fix the wiring so everything aligns perfectly. --- ## 🧠 Big picture (why this keeps happening) Modern diffusion stacks are fragile because: - Models ≠ interchangeable - Encoders ≠ interchangeable - Dimensions must match exactly You're basically plugging: > a 3584-dimensional brain into a 2560-dimensional skull It won’t compress. It just crashes. --- If you want, I can also build you a **minimal, working GGUF-only ComfyUI graph** that avoids all of this.
gpt-5-3
do I just need a different clip model?
Short answer: **yes—but not just “any” different CLIP. You need the *exact* encoder your model was trained with.** Right now your situation is: - Model expects → **2560-dim embeddings** - Your encoder outputs → **3584-dim** - → 💥 mismatch → crash --- ## 🧠 What “different CLIP model” really means This isn’t just swapping CLIP files randomly. There are **different families of text encoders**: | Encoder type | Typical dim | |-------------|------------| | OpenCLIP (ViT-L, etc.) | 768 / 1024 | | Big OpenCLIP variants | 1280 / 1536 / 3584 | | SigLIP | often **2560** | | T5 (used in some pipelines) | varies (often large like 4096) | 👉 Your error screams: > You’re using a **3584 encoder**, but the model wants **2560 (likely SigLIP)** --- ## 🔥 So the real answer ### ✅ YES — you need a different encoder ### ❗ BUT it must match the model exactly --- ## 🛠️ What you should do next ### 1. Identify your model What GGUF are you using? Look for clues like: - “siglip” - “lumina” - “2560” - model repo README --- ### 2. Swap your encoder node In ComfyUI, find what you're using: - `CLIP Loader` → ❌ probably wrong - `OpenCLIP` → ❌ likely your 3584 source 👉 Replace with: - **SigLIP loader** (if your model expects 2560) --- ### 3. Fix your wiring Make sure: - Prompt → correct encoder → model - No leftover CLIP nodes still connected --- ## 🚨 Important (this bites people a lot) Even if: > “the graph looks connected” You can STILL have: - hidden mismatches - wrong encoder feeding into conditioning --- ## 🧪 Quick mental check Ask yourself: > “Was this workflow built for THIS exact model?” If not → assume it’s broken until proven otherwise. --- ## 💣 If you're using GGUF-only This is even stricter: - Many GGUF pipelines are **hard-coupled to specific encoders** - Some expect: - SigLIP - or internal embedding logic 👉 You can’t mix and match like older Stable Diffusion setups --- ## 🧭 If you want the fastest fix Send me: - your **GGUF model name** - screenshot or JSON of your graph I’ll tell you exactly: - which encoder to use - what nodes to delete - what to reconnect --- ## TL;DR > ✔ Yes, you need a different CLIP > ❌ No, not just any CLIP > ✅ You need the **exact encoder that outputs 2560 dims (likely SigLIP)** Once that matches → your error disappears instantly.
gpt-5-3