Skip to content

feat(upscale): support Krea-2 Turbo and Raw in the Upscale widget - #9889

Merged
lstein merged 10 commits into
invoke-ai:mainfrom
Pfannkuchensack:feat/upscale-krea2
Oct 18, 2026
Merged

lstein merged 10 commits into
invoke-ai:mainfrom
Pfannkuchensack:feat/upscale-krea2

Conversation

@Pfannkuchensack

@Pfannkuchensack Pfannkuchensack commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Summary

The Upscale widget can now use Krea-2 Turbo and Krea-2 Raw main models. The pass works like FLUX.1, Z-Image and Anima: Spandrel enlarges the image, then one img2img pass runs over the whole frame. It encodes and decodes with the Qwen-Image VAE (qwen_image_i2l / qwen_image_l2i, both tiled), the same nodes Generate and Canvas use for Krea-2. No new nodes.

  • Components: a single-file or GGUF Krea-2 needs a Qwen3-VL Encoder (the 4B) and a Qwen-Image VAE, both pre-filled. Ideogram 4's 8B encoder is the same model type and is never offered, since krea2_model_loader refuses it. A Diffusers install brings its own.
  • CFG: picking the model sets its served default: 1 for Turbo, 5.5 for Raw. The negative prompt is wired only above CFG 1.
  • Scheduler: krea2_denoise has no scheduler input, so the field is hidden and the metadata records Euler. Steps keep the widget value for both variants.
  • Creativity: krea2_denoise clips denoising_start by step index, like Z-Image and Anima, so the widget translates Creativity to the step nearest FLUX's entry sigma. Two things differ from those nodes:
    • Krea-2 rounds start * steps (Python's half-to-even) where the others floor it, so its start is the step itself, not the middle of the step.
    • Its shift depends on the variant: Turbo's mu is fixed at 1.15, and Raw's follows the frame size.
    • To carry this, the table field indexClippedShift(size) becomes indexClipping: { shift(model, size), rounding }.
  • Balanced at 30 steps on a 2048² result starts at step 23 for both variants and runs 7 steps.

Depends on #9887, which holds Raw's mu at 1280×1280 of area. Without it, Raw at 4096² enters at sigma 0.98 and replaces the image.

Related Issues / Discussions

Block 5 of the upscale work. Follows #9825 (Z-Image and Anima). Requires #9887.

Until #9887 is merged, this branch also carries its commit (22be8138d9, the Raw shift hold). Only the second commit (6a38e3f957) belongs to this PR; the branch will be rebased onto main once #9887 lands.

QA Instructions

Automated

  • webv2, run one by one:
    • lint (oxfmt, oxlint, tsc --noEmit, architecture): pass.
    • test: 10,196 passed. On this German-locale machine, 3 tests that format numbers with the system locale fail the same way without this change.
    • Browser tests rendering the Upscale and Generate panels: 72 passed.
    • test:performance:architecture (build and browser), test:project-files:browser, test:accessibility:browser (19) and test:fixtures (32): pass.
  • test_upscale_index_clipped_starts.py and test_frontend_graph_node_types.py: 889 passed, 3 skipped.
    • The fixture now records Krea-2 Turbo and Raw cases with their variant: Raw at 512/1024/2048/4096, so the hold is crossed.
    • Each case drives the real krea2_denoise._run_diffusion with the real diffusers scheduler up to the img2img blend, and checks that the entry is the step nearest FLUX's.
    • Translating Krea-2 with the floor rule fails 33 cases. A backend without fix(krea2): hold Raw's schedule shift at the end of its fit #9887's hold fails 14.
  • The upscale graph contract now covers six architectures: 45 node types and 189 literal values.

End to end (RTX 4090, 1024² source, Balanced, through the Invoke button):

Model Result Start Time
Krea-2 Turbo int8, CFG 1 2048² 23/30, no negative branch 75 s
Krea-2 Raw Q4_K_M GGUF, CFG 5.5 2048² 23/30, negative branch 86 s
Krea-2 Raw Q4_K_M GGUF, CFG 5.5 4096² (4×) 23/30 8:46 min

All three keep the composition and lettering:

  • Turbo adds paper grain and painterly stone texture.
  • Raw stays closer to the source's colors.
  • At 4096², a 100% crop is slightly smoother than the frame.

UI, checked in the browser

  • Picking Krea-2 Turbo shows CFG 1, no scheduler field, the Qwen3-VL Encoder picker pre-filled with the 4B (not the 8B), and the Qwen-Image VAE. Raw shows CFG 5.5.
  • The output size reads 2,048 × 2,048 for the 1024² source at 2×.

Review

Findings resolved:

  • The docs' memory section now covers Krea-2.
  • The Python scheduler check ties Krea-2's Euler-only list to the node having no scheduler input.

Remaining:

  • The frontend copies the stock Krea-2 shift constants. A Diffusers install samples with its own scheduler/scheduler_config.json. Krea's ships the same numbers. A checkpoint whose config differed would move Raw's starts below 1280×1280 without the contract test noticing.

Compatibility / Rollout

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Meaningful regression coverage added / updated where needed; obsolete tests/code removed
  • Persisted-state and API changes include required migrations / compatibility validation
  • Relevant performance/efficiency opportunities considered; material claims have evidence
  • Material review findings resolved and relevant checks rerun
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Krea-2 Raw's mu kept climbing past 6400 image tokens (2.21 at 2048², 7.41 at 4096²);
calculate_shift now holds it at the fit's end, as the FLUX.1, Z-Image and LTX-2 fits do.
krea2_denoise 1.3.1; Turbo and an explicit shift are unchanged.
Adds a Krea-2 path (tiled Qwen-Image VAE, krea2_denoise) with a Qwen3-VL 4B slot and served CFG defaults.
The index-clipping table entry now carries the node's rounding rule, since krea2_denoise rounds its start.
@github-actions github-actions Bot added python PRs that change python files invocations PRs that change invocations backend PRs that change backend files frontend PRs that change frontend files python-tests PRs that change python tests docs PRs that change docs labels Oct 16, 2026
@lstein
lstein enabled auto-merge (squash) October 17, 2026 22:30
@lstein

lstein commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

CI was failing on all three Python test jobs because SUPPORTED_BASE_COUNTS in tests/app/invocations/test_frontend_graph_node_types.py still pinned the upscale panel at 5 architectures, while the regenerated snapshot now lists 6 (Krea-2 added). This was a trivial fix, so I took the liberty of updating the branch directly (6c1a931: "upscale": 5 → 6).

@lstein
lstein merged commit 59ecd95 into invoke-ai:main Oct 18, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend PRs that change backend files docs PRs that change docs frontend PRs that change frontend files invocations PRs that change invocations python PRs that change python files python-tests PRs that change python tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants