Skip to content

Conversation

@VipCrazyMaster
Copy link

Background / 背景

After upgrading to ComfyUI master, QwenImage-based nodes could crash
(e.g. 'list' object has no attribute 'dtype') or silently drift in generation
due to positional argument mismatch in _forward.

在升级到 ComfyUI master 之后,QwenImage 相关节点可能出现
'list' object has no attribute 'dtype' 报错,
或者由于 _forward 位置参数错位而导致生成语义漂移(模型不听 prompt)。


What this PR does / 本次修改内容

  • Aligns _forward parameter order with ComfyUI master implementation
    对齐 _forward 的参数顺序,使其与 ComfyUI master 实现保持一致
  • Removes legacy guidance handling from time_text_embed
    移除历史遗留的 guidance 注入逻辑,避免参数错位
  • Safely unwraps single-element additional_t_cond without changing semantics
    仅对单元素 additional_t_cond 做安全解包,拒绝多元素以避免语义变化
  • Adds bilingual (CN/EN) comments explaining the compatibility constraints
    增加中英文注释,说明与 ComfyUI master 兼容所需的约束条件

Why this is safe / 修改安全性说明

  • Matches upstream comfy/ldm/qwen_image/model.py signatures exactly
    与上游 comfy/ldm/qwen_image/model.py 的函数签名完全一致
  • Refuses to merge multi-element lists to avoid CFG / conditioning drift
    明确拒绝合并多元素列表,避免 CFG / 条件语义漂移
  • No behavior change when inputs are already tensors
    当输入已是 tensor 时,不会引入任何行为变化

Tested / 测试环境

  • ComfyUI master
  • Python 3.12 / PyTorch 2.7
  • QwenImage + ComfyUI-nunchaku

- Align _forward parameter order with ComfyUI master to avoid positional mismatch
- Use time_text_embed(timestep, hidden_states, additional_t_cond) only
- Unwrap single-element additional_t_cond (refuse multi-element to avoid semantic drift)
- Add bilingual (CN/EN) comments for maintainability
@VipCrazyMaster
Copy link
Author

EN

Refuses to merge multi-element list/tuple for tensor-like inputs (e.g. additional_t_cond) to avoid CFG/conditioning semantic drift; multi-image inputs are handled via ref_latents as intended.

CN

仅对 additional_t_cond 等“tensor-like 输入”拒绝合并多元素 list/tuple,以避免 CFG/conditioning 语义漂移;多图输入按设计通过 ref_latents 传入并由模型内部逻辑处理。

@HelloClyde
Copy link

great! it works

@Michoko92
Copy link

Does your fix work also with Qwen edit models? For some reason, I still get the error with Qwen Image Edit 2509 if I put your file in the ComfyUI backend of SwarmUI.

@VipCrazyMaster
Copy link
Author

Does your fix work also with Qwen edit models? For some reason, I still get the error with Qwen Image Edit 2509 if I put your file in the ComfyUI backend of SwarmUI.

SwarmUI没有试过,考虑是否是SwarmUI接口问题?因为我修复后在openwebui中是可以正常调用comfyui的。

@Michoko92
Copy link

Does your fix work also with Qwen edit models? For some reason, I still get the error with Qwen Image Edit 2509 if I put your file in the ComfyUI backend of SwarmUI.

SwarmUI没有试过,考虑是否是SwarmUI接口问题?因为我修复后在openwebui中是可以正常调用comfyui的。

I found the issue. It seems that SwarmUI keeps another copy of the Nunchaku nodes here:

SwarmUI\src\BuiltinExtensions\ComfyUIBackend\DLNodes\ComfyUI-nunchaku

I replaced the qwenimage.py in the models directory there too, and it works now! Thank you for the fix! 🙏

@DZFarouk7
Copy link

guys for the non savvy ,just run this commnd in the in omfyUI\custom_nodes\nunchaku_nodes git fetch origin pull/728/head:pr-728
git checkout pr-728

@istherea
Copy link

Thanks for sharing this! I was struggling with the exact same AttributeError after the recent ComfyUI update, and applying the PR #728 fix solved it perfectly for my QwenImageEdit-2509 workflow. Appreciate the help

@LV-Soft
Copy link

LV-Soft commented Dec 27, 2025

work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants