Skip to content

Conversation

@chriscombs
Copy link

@chriscombs chriscombs commented Nov 8, 2025

Motivation

Resolves #608, potentially other Controlnet related issues. After ComfyUI updated their Controlnet nodes it seems to have broken the Nunchaku implementation.

Nunchaku applies x_embedder to hidden_states in one of the forward calls but never applies the same to controlnet: https://github.com/nunchaku-tech/nunchaku/blob/ab324e25cc32420f36dfcab4d0f2180417f2d1d4/nunchaku/models/transformers/transformer_flux.py#L947

This mismatch doesnt get caught until the C++ FluxModel https://github.com/nunchaku-tech/nunchaku/blob/ab324e25cc32420f36dfcab4d0f2180417f2d1d4/src/FluxModel.cpp#L1286

Modifications

Ensure the controlnet tensor shapes match the expected hidden_states shape, and apply the x_embedder if applicable. Also adds some further assertions to fail earlier.

I imagine this would probably be better fixed at nunchaku/models/transformers/transformer_flux.py but I don't know diffusers well enough to test it outside of ComfyUI.

@chriscombs chriscombs marked this pull request as draft November 8, 2025 22:01
@chriscombs chriscombs marked this pull request as ready for review November 8, 2025 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ControlNet Union Pro1 causes ComfyUI reboot

1 participant