Qwen Image BS>1: remaining double-pass of encoder_hidden_states_mask after v4.1.2
## Context
v4.1.2 fixed the padding corruption for Qwen Image BS>1 training — the core issue from #2647/#2648/#2655 is resolved. However there's one remaining edge case: `encoder_hidden_states_mask` gets passed twice to `self.attn()` in `DoubleStreamLayer`, causing a `TypeError` at step 0.
## Error
```
TypeError: Attention(...) got multiple values for keyword argument 'encoder_hidden_states_mask'
```
## Cause
In `helpers/models/qwen_image/transformer.py`:
- Main `forward()` at line ~1204 stuffs the mask into `block_attention_kwargs`
- `DoubleStreamLayer.forward()` also receives it as an explicit parameter
- When `self.attn()` is called with both the explicit kwarg AND `**joint_attention_kwargs`, Python sees the kwarg twice
## Fix
Remove line ~1204 (`block_attention_kwargs["encoder_hidden_states_mask"] = encoder_hidden_states_mask`). The mask already flows via the explicit parameter through the block call chain.
## Validated
- ST 4.1.2, PRO 6000, Qwen Image v2.0, LoRA r32, BS=4
- With fix: clean validation samples at steps 25, 50, 75
- Happy to PR this — it's one line
关闭于 2026-03-29 1 条评论