Skip to content

fix qwenimage mask ordering, tensor images, layered output, vae clamp, and exports#14147

Open
akshan-main wants to merge 1 commit into
huggingface:mainfrom
akshan-main:fix-qwenimage-review
Open

fix qwenimage mask ordering, tensor images, layered output, vae clamp, and exports#14147
akshan-main wants to merge 1 commit into
huggingface:mainfrom
akshan-main:fix-qwenimage-review

Conversation

@akshan-main

@akshan-main akshan-main commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Part of #13581 (qwenimage review). Fixes six of the findings:

  • Batched prompts with num_images_per_prompt > 1 paired attention masks with the wrong prompt: prompt_embeds expanded to [p0, p0, p1, p1] but the mask to [p0, p1, p0, p1]. Both now use repeat_interleave (the embeds tensor is unchanged, only the mask alignment is fixed).
  • Tensor image inputs crashed on image.size (a method on Tensor, not a tuple) before preprocessing, in the edit / edit-inpaint / edit-plus / layered pipelines and the modular encoder. Now read the shape for tensors.
  • QwenImageLayeredPipeline(output_type="latent") returned an undefined images (the latent branch assigned image), so it raised instead of returning latents.
  • Layered zero_cond_t doubled timestep but not additional_t_cond, so batch > 1 mismatched in the time embedding. Now both are doubled.
  • Tiled VAE decode skipped the [-1, 1] clamp that plain decode applies, so tiling shifted the output range. Now clamped, matching _decode and the Wan VAE.
  • __init__ lazily exported QwenImagePriorReduxPipelineOutput and ReduxImageEncoder, neither of which exists here (Redux is a Flux feature), so importing the subpackage failed. Removed.

The guidance-path finding is a dead code path (nothing sets guidance_embeds), and the test-coverage finding is tracked separately as issue 8 of #13581.

Fixes #13581
Part of the huge #13656 take over

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline?
  • Did you read our philosophy doc (important for complex PRs)?
  • Was this discussed/approved via a GitHub issue or the forum? Discussed on Slack with @yiyixuxu
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Who can review?

@yiyixuxu

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Hi @akshan-main, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Fixes #1234) to the PR description so the issue is linked. See the contribution guide for more details. If this PR intentionally does not fix a tracked issue, a maintainer can add the no-issue-needed label to silence this reminder.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

qwenimage model/pipeline review

1 participant