
Something weird is going on with Dual Model CFG / Ideogram when utilizing torch compile
快速结论:该问题发生在 ComfyUI 中使用 torch compile 高级节点并配合 Dual Model CFG 或 Ideogram 模型时,输出图像会出现异常平滑。优先检查 KJNodes 是否已更新到包含修复的版本,该修复避免了 compile wrapper 内部权重混淆的问题。
问题场景
用户在 ComfyUI 中使用 KJNodes 节点的 “torch compile advanced” 功能,配合 Dual Model CFG 或 Ideogram 模型进行推理。启用 compile 后,Ideogram 的输出图像会出现奇怪的平滑效果,与不使用 compile 的结果差异明显。
报错原文
"Something weird is going on with Dual Model CFG / Ideogram when utilizing torch compile.
When using the torch compile advanced node, ideogram outputs become weirdly smoothed out."
"It seems to be somewhat related to the CFG value. Like it accidentally is multiplying it by some amount(?)."
原因分析
该问题的根本原因是 compile wrapper 在内部混淆了模型的权重(weights)。当 compile 进行图优化时,未能正确区分 Dual Model CFG 中两个模型的权重,导致输出结果异常平滑。可能原因还包括 CFG 值被意外放大——当将 CFG Override 起始/结束值设为 1.0(相当于禁用 CFG Override)并将 Dual Model CFG 设为 1.5 时,compile 和不 compile 的输出差异显著缩小。
环境排查
- ComfyUI 及 KJNodes 插件版本(需包含 commit fadde42973faa83b50cb73c8cd7d584d3744febb 及之后的修复)
- PyTorch 版本(兼容 torch.compile 的版本,如 2.x 系列)
- CUDA 版本和显卡驱动
- 显卡型号(用户测试环境包含 RTX 3090)
- 是否使用 INT8 量化节点、模型精度(bf16 或 INT8)
- 注意力优化方式(SDPA 或 flash attention)
解决步骤
- 更新 KJNodes 到包含 fix 的版本,确认 commit fadde42973faa83b50cb73c8cd7d584d3744febb 已被包含。
- 如果无法立即更新,可优先尝试将 CFG Override 起始/结束值设为 1.0(即禁用 CFG Override),并将 Dual Model CFG 值设为 1.5 作为临时缓解方案。
- 确认 compile wrapper 未误用模型权重:修复后的版本通过重新实现 wrapper 逻辑,避免权重混淆。如果仍有异常,请检查是否与其他自定义节点冲突。
- 测试时建议对比 compile 开启前后的输出图像质量,而非仅关注速度。
- 注意:此模型在 compile 下的速度行为存在特殊性——例如 1024×1024 分辨率下配合 flash attention 反而变慢,仅 SDPA 略有加速;1440×1440 分辨率下才获得明显加速。
验证方法
使用相同的种子和参数,分别开启和关闭 torch compile,对比生成图像质量。异常平滑效果消失且图像细节恢复清晰,说明问题已修复。建议同时验证 CFG 值对输出的影响是否恢复正常。



