Skip to content

Feat/clear intermediates#3

Merged
joshistoast merged 5 commits into
v7from
feat/clear-intermediates
Jun 29, 2026
Merged

Feat/clear intermediates#3
joshistoast merged 5 commits into
v7from
feat/clear-intermediates

Conversation

@joshistoast

Copy link
Copy Markdown
Collaborator

Summary

Add clear intermediates feature to settings dialog.

Related Issues / Discussions

QA Instructions

Merge Plan

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

lstein and others added 5 commits June 28, 2026 10:04
…ai#9309)

* fix metadata overrides with empty string values

* chore(backend): ruff

---------

Co-authored-by: wunianze666-netizen <wunianze666@gmail.com>
Co-authored-by: Alexander Eichhorn <alex@eichhorn.dev>
Co-authored-by: Jonathan <34005131+JPPhoto@users.noreply.github.com>
* fix(z-image): repair regional guidance forward after diffusers refactor

Z-Image Regional Guidance crashed with "split_with_sizes expects
split_sizes to sum exactly to 162 ... but got split_sizes=[160]". The
regional-prompting patch was a hand-copied snapshot of an outdated
ZImageTransformer2DModel.forward. The installed diffusers version
changed _pad_with_ids so caption pos_ids are now longer than the
caption feature tensor, while the stale patch split RoPE embeddings by
feature lengths instead of pos_ids lengths.

Rewrite create_regional_forward to delegate to the model's own helpers
(patchify_and_embed, _prepare_sequence, _build_unified_sequence) and
only override the main-layer attention mask to inject the regional
mask. This keeps the patch in sync with upstream diffusers and stops
re-implementing the drift-prone patchify/RoPE/padding logic.

* fix(z-image): repair & realign regional guidance after diffusers refactor

Z-Image Regional Guidance crashed with "split_with_sizes expects
split_sizes to sum exactly to 162 ... but got split_sizes=[160]". The
regional-prompting patch was a hand-copied snapshot of an outdated
ZImageTransformer2DModel.forward; the installed diffusers version
changed _pad_with_ids so caption pos_ids are longer than the caption
feature tensor, while the stale patch split RoPE embeddings by feature
lengths instead of pos_ids lengths.

Rewrite create_regional_forward to delegate to the model's own helpers
(patchify_and_embed, _prepare_sequence, _build_unified_sequence) so it
stays in sync with upstream diffusers, and only override the main-layer
attention mask.

Also fix two reasons regional guidance had no visible effect:
- Mask alignment: the unified sequence pads the image and caption
  blocks individually to a multiple of 32, so the real layout is
  [img_real | img_pad | txt_real | txt_pad]. Scatter the four regional
  sub-blocks into their padding-aware positions instead of assuming a
  contiguous top-left block (which only matched square 1024x1024).
- CFG pass: the patched forward also runs for the negative prompt; only
  apply the regional mask to passes whose caption length matches the
  positive prompt, otherwise fall back to the plain padding mask.

* Chore Ruff + Typegen

* fix(z-image): use identity to gate regional mask onto the positive pass

The regional attention patch ran for both the conditioned and negative/CFG
forward passes and distinguished them by comparing the padded caption length
against the positive prompt's expected length. Two short prompts that round up
to the same multiple of 32 collided, so the positive regional mask could be
injected into the unconditional prediction and silently corrupt CFG.

Discriminate the conditioned pass by tensor identity (cap_feats is the exact
positive_cap_feats the mask was built for) instead of a length heuristic, so
the positive and negative passes can never be confused. The context manager now
requires positive_cap_feats whenever a regional mask is provided, turning the
previously inferred invariant into an enforced one rather than a silent no-op.

Also build the (bsz, 1, S, S) float mask lazily: compute applied_regional from
cheap scalar checks first and skip materializing/cloning the full mask on passes
that never match (every negative pass), avoiding a ~33 MB bf16 clone per call.

---------

Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
…ai#9312)

Add .github/FUNDING.yml to enable the "Sponsor" button on the repo
home page, pointing to the invoke-ai GitHub Sponsors org page. Also
add a "Sponsors" section to the README with a sponsor call-to-action
and badge.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@joshistoast joshistoast merged commit 4339bc2 into v7 Jun 29, 2026
19 checks passed
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.

3 participants