Skip to content

Fix SparseCtrl RGB conditioning under CFG (#9508)#10

Open
srlynch1 wants to merge 2 commits into
mainfrom
e2e/diffusers-9508
Open

Fix SparseCtrl RGB conditioning under CFG (#9508)#10
srlynch1 wants to merge 2 commits into
mainfrom
e2e/diffusers-9508

Conversation

@srlynch1

Copy link
Copy Markdown
Owner

Summary

  • Fix AnimateDiff SparseCtrl RGB conditioning when classifier-free guidance is enabled by doubling controlnet_cond and controlnet_cond_mask for the unconditional/conditional batch (matching ControlNet pipeline behavior).
  • In guess_mode, zero-pad controlnet residuals so they apply only to the conditional batch, for parity with pipeline_controlnet.
  • Add regression test test_conditioning_image_affects_output_with_unrelated_prompt and remove the prior @unittest.expectedFailure workaround for AnimateDiff SparseCtrl RGB does not work as expected huggingface/diffusers#9508.

Test plan

  • pytest tests/pipelines/animatediff/test_animatediff_sparsectrl.py::AnimateDiffSparseControlNetPipelineFastTests::test_conditioning_image_affects_output_with_unrelated_prompt -v
  • pytest tests/pipelines/animatediff/test_animatediff_sparsectrl.py -v
  • Run SparseCtrl inference with CFG (guidance_scale > 1) and confirm conditioning RGB frames affect output with an unrelated prompt

Made with Cursor

srlynch1 and others added 2 commits June 21, 2026 21:43
Documents the open bug where conditioning images are ignored when the
prompt is unrelated; test inspired by community PR huggingface#12115.

Co-authored-by: Cursor <cursoragent@cursor.com>
Align controlnet_cond batch size with classifier-free guidance and add
guess_mode zero-padding for unconditional residuals, matching pipeline_controlnet.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant