
IPAdapter Advanced issues with torch Size, n
快速结论:这个报错通常发生在 ComfyUI 中使用 IPAdapter Advanced 节点且模型版本不匹配时,优先排查所使用的 CLIP Vision 模型与 IPAdapter 模型是否配套(例如 SDXL 模型与 ViT-H 或 ViT-G 混用)。
问题场景
用户使用 ComfyUI(最新版本)和 ComfyUI_IPAdapter_plus 插件,在工作流中使用 IPAdapter Advanced、IPAdapter Unified Loader、IPAdapter Embeds 节点时,加载 checkpoint 后进程中断。
报错原文
size mismatch for proj_in.weight: copying a param with shape torch.Size([1280, 1280]) from checkpoint, the shape in current model is torch.Size([1280, 1668])
同时日志中可见 CLIP Vision 模型信息:CLIPVision embed_dim= 1664,而 IPAdapter 的 proj_in.weight 期望 shape 为 [1280, 1280],但当前模型为 [1280, 1668](或 [1280, 1664])。
原因分析
可能原因:CLIP Vision 模型(如 CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors)的维度 (embed_dim=1664) 与 IPAdapter 模型(如 ip-adapter-plus_sdxl_vit-h.safetensors)期望的输入维度 (1280) 不匹配。用户的 CLIP Vision 初始化为 1664 维(通过 clip_vision_config_g.json),而 IPAdapter 的 proj_in.weight 要求 1280 维,导致 PyTorch 在加载 checkpoint 时因形状不同引发 size mismatch。
从日志看,用户 IPAdapter 的加载信息显示 embedding_dim 1664、dim 1280,可能是因为模型文件下载或组合有误(如将 SD1.5 或 SDXL 的 CLIP Vision 与不同版本的 IPAdapter 混用)。用户回忆可能是“手动下载的一个 checkpoint 文件有问题”。
环境排查
- ComfyUI 本地版本(应为最新)
- ComfyUI_IPAdapter_plus 插件版本
- 使用的 CLIP Vision 模型:
CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors(需确认是否适用于 SDXL 的 IPAdapter) - IPAdapter 模型:
ip-adapter-plus_sdxl_vit-h.safetensors(需确认模型来源及完整性) - 是否手动替换或混用了不同的模型文件
- Python / PyTorch / CUDA 版本(未直接提及,但影响 Torch 加载)
解决步骤
- 核对模型组合:确保 CLIP Vision 模型(如
clip-vit-large-patch14系列)与 IPAdapter 模型版本对应。例如ip-adapter-plus_sdxl_vit-h.safetensors通常需要搭配CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors且模型路径正确。 - 重新下载模型:可优先尝试从官方源重新下载所有涉及模型文件,避免手动下载出现损坏或不完整的情况。
- 检查 config 文件:确认
ComfyUI\comfy\clip_vision_config_g.json配置是否指向了正确的维度(如embed_dim应为 1280 而非 1664)。 - 清理缓存:删除 ComfyUI 中可能存在的无效或重复模型文件,尤其是
CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors的旧版本。 - 重置工作流:移除并重新添加 IPAdapter Advanced 和 IPAdapter Unified Loader 节点,确保加载的模型路径无错。
验证方法
重新执行同一个工作流,观察日志中不再出现 size mismatch 错误,且 IPAdapter 成功加载 proj_in.weight。同时确认 CLIP Vision 模型的 embed_dim 与 IPAdapter 的 input_dim 一致,推理即可正常进行。


![[Bug]: `refresh_ref_docs()` / `arefresh_ref_docs()` drop kwargs after the first document in a batch](https://www.chat-gpts.plus/wp-content/uploads/2026/06/21518-40a95a4b-768x403.jpg)
