Repository navigation
feat(controlnet): add FLUX.2 [dev] Fun-ControlNet-Union with canvas control layers - #9924
Open
Pfannkuchensack wants to merge 11 commits into
Open
Pfannkuchensack wants to merge 11 commits into
Pfannkuchensack wants to merge 11 commits into
Conversation
…trol layers Add alibaba-pai's VACE-style control branch for Qwen-Image: identification, loader, the qwen_image_control node and control/inpaint conditioning in the denoise, injected through forward hooks on the diffusers transformer. The canvas gets a Qwen Image ControlNet layer kind with inpaint/outpaint feeding and a grayscale filter; the denoise now reserves working memory for its activations.
…ontrol layers Loads alibaba-pai's FLUX.2-dev union as a FLUX.2 ControlNet, runs its control blocks on the shared hook helper and adds a Canvas control kind with inpaint wiring. The control encodes inside Denoise - FLUX.2 retry tiled after running out of memory, like Image to Latents - FLUX.2.
Member
Author
…feat/flux2-fun-controlnet
…trings The Qwen-Image and FLUX.2 [dev] ControlNet strings add 0.5 KB to the locale file every route loads; request counts are unchanged.
2 of 7 tasks
5 of 7 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
FLUX.2 [dev] had no ControlNet in Invoke. alibaba-pai's FLUX.2-dev Fun-ControlNet-Union (Canny, Depth, Pose, HED, MLSD, Scribble, Gray, plus inpainting) uses the same VACE-style branch as the Qwen-Image union from #9914, so this PR adds it on the same hook helper.
…-2602build (FLUX [dev] Non-Commercial License).Related Issues / Discussions
Builds on #9914 (shared Fun-ControlNet helper); merge after it.
QA Instructions
RTX 4090, FLUX.2 dev fp8mixed (33.8 GB, partially loaded) + Mistral fp8 encoder,
FLUX.2-dev-Fun-Controlnet-Union-2602, 28 steps, guidance 4, scale 0.75, ~1 MP:flux2_control→denoise_latents.control, output follows the skeletonNumerical checks on CPU: the hook path equals a restatement of VideoX-Fun's stacked formulation (
torch.equal, randomly initialised tiny model, with reference tokens); the context builder equals VideoX-Fun's context code; the node's context wiring is checked against independently computed control-only and inpaint-only contexts; per-step gating covers Euler, Heun (two forwards per step) and the manual-Euler path.The 8.2 GB branch runs mostly offloaded next to the partially loaded transformer on a 24 GB card. Two runs right after a server start hit the driver's system-memory fallback (VRAM full, 12–18 s/step); this did not recur in the interleaved A/B. A run with a FLUX.2 reference image in the graph reserves more working memory and ran at ~9 s/step.
Checks: focused pytest (fun_controlnet, FLUX.2 control/denoise/VAE, configs, loaders, fp8 capability, frontend graph contracts, model identification): passed;
pnpm lint; webv2 tests for control validation, adapters, canvas migration, layer checks, canvas compile andControlLayerSettingsbrowser test: passed (2 unrelated failures under a German locale). Ruff clean.Review
Resolved: the node's control-context wiring is now covered by value-level tests (swapped images, inverted mask or missing normalisation each fail); the control encodes gained the tiled retry the docs promised; the docs name the 2602 build and why; the Klein error is readable. Remaining: the
+4activation term reuses Z-Image's coefficient and is not measured for FLUX.2; the model cache logs a "VRAM budget short" warning for the branch on every partially loaded [dev] run (expected, also seen for Qwen/Z-Image); Klein still lists the control kind because capabilities are per base, and the layer then shows the refusal.Compatibility / Rollout
flux2_denoise1.6.0 → 1.7.0 with an optionalcontrolinput; newflux2_controlnode; new config tagcontrolnet.checkpoint.flux2; new control kindflux2_controlin capabilities (fixture regenerated). The shared context builder is renamedbuild_fun_control_context(not yet on main).openapi.json/schema.tsregenerated. Existing workflows and canvases load unchanged; no migration.Checklist
What's Newcopy (if doing a release after this PR)Need help on this PR? Tag
@codesmith-botwith what you need.