π§ DiffSynth ControlNet (Fixed)
A fixed copy of a core ComfyUI node, for when your mask arrives 5D
- model
- model_patch
- vae
- image
- mask
- MODEL
Most custom nodes are new things. This one is a correction: a fixed copy of ComfyUI's built-in QwenImageDiffsynthControlnet node, shipped in this pack because the author hit a real bug and decided to just publish the fix. If you use the DiffSynth-style block-wise ControlNet for Qwen-Image models, you may have seen the original misbehave when you fed it a mask - this is the version that doesn't.
What the bug was
In ComfyUI's comfy_extras/nodes_model_patch.py (lines 382β385), the original code has two consecutive if mask.ndim == 4 statements where the second should be an elif. Result: a 4D mask gets the unsqueeze applied twice, producing a 5D tensor where the model expects 4D. Depending on how your mask came out of an upstream node, you'd get a silent shape mismatch or a hard error. The fix here is one line - the second if becomes elif - and this node is the packaged result.
How it works
The node applies a block-wise ControlNet patch to a model (MODEL_PATCH input) using an image encoded through the provided VAE. "DiffSynth" in this context means the ControlNet operates inside the model's transformer blocks rather than as a separate UNet-style network - the QwenImageBlockWiseControlNet mechanism. If model_patch has an additional input dimension (the mask channel), the optional mask is upscaled to match the latent and concatenated in, which is how you get region-limited control. No mask, and it uses a ones-mask of the right shape, i.e. control everywhere.
Inputs:
model- the base model being patched.model_patch- the Qwen/ControlNet model patch (e.g. a loaded DiffSynth controlnet).vae- used to encode the conditioning image.image- the reference image that drives the control.strength- default 1, range -10 to 10. This is a big one: negative strength inverts the control direction, which is occasionally exactly what you want for anti-control experiments.mask- optional; the region to limit control to.
Output: a MODEL - the patched model, ready to hand to a sampler. The code also handles the Z-Image control patch variant, so this one node covers both Qwen-Image and Z-Image control models.
When you'd reach for it
If you're running the latest ComfyUI, the upstream bug may already be fixed and you don't need this at all. Reach for it when: you hit a mask shape error on the stock node, you're on a ComfyUI version pinned to a build with the bug, or you want the Z-Image handling in a single node. It's a "known-good copy" play - the node exists because the author needed it, not because it adds a feature.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/amir84ferdos/ComfyUI-ArchAi3d-Qwen.git
cd ComfyUI-ArchAi3d-Qwen && pip install -r requirements.txt
Or ComfyUI Manager β search "ArchAi3d Qwen" β Install β restart. Category is ArchAi3d/ControlNet. And since it's just a fixed port, the usual ControlNet workflow rules apply - the KB's controlnet essay is the refresher: control maps steer structure, they don't add detail on their own. License note: free personal, paid commercial.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | β | |
| model_patch | MODEL_PATCH | β | |
| vae | VAE | β | |
| image | IMAGE | β | |
| strength | FLOAT | 1.00-10β10 | β |
| maskopt | MASK | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | β |