Skip to content

fix: Handle ControlNet conditioning args correctly in do_controlnet_step (closes #9444) - #9469

Open
botbikamordehai2-sketch wants to merge 1 commit into
invoke-ai:mainfrom
botbikamordehai2-sketch:fix/issue-9444-1786015613
Open

fix: Handle ControlNet conditioning args correctly in do_controlnet_step (closes #9444)#9469
botbikamordehai2-sketch wants to merge 1 commit into
invoke-ai:mainfrom
botbikamordehai2-sketch:fix/issue-9444-1786015613

Conversation

@botbikamordehai2-sketch

Copy link
Copy Markdown

What

During Krea-2 image generation, a crash occurs in do_controlnet_step because the controlnet path passes incorrect arguments to the model forward callback. The original code attempts to modify sample_model_input but never actually calls the model forward, and the callback signature is inconsistent. This leads to a TypeError and crash.

Fix

  • Added a None-check on control_data to avoid iterating over None.
  • Built cross_attention_kwargs containing the controlnet residuals and conditioning settings.
  • Call model_forward_callback with the correct arguments, including a fallback for callbacks that don't accept cross_attention_kwargs.
  • Return the updated sample from the method.

This ensures ControlNet steps work for models like Krea-2 that expect the proper conditioning format.

Closes #9444

@github-actions github-actions Bot added python PRs that change python files backend PRs that change backend files labels Aug 6, 2026
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 python PRs that change python files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: InvokeAI v6.14.0-RC1 Crashed while generating Krea-2 Image

1 participant