Repository navigation
Conversation
…ipelines Both SD3 ControlNet pipelines resolved the public `controlnet_pooled_projections` argument with `controlnet_pooled_projections or pooled_prompt_embeds`. `or` evaluates the truthiness of the left operand, so passing any real pooled projection raises `RuntimeError: Boolean value of Tensor with more than one value is ambiguous`, making the argument unusable. In the text-to-image pipeline, replace the `or` with an explicit `None` check. In the inpainting pipeline the `else` branch is only reachable when the value is not `None`, so it could only ever re-assign the value to itself or raise; drop it. Add a regression test that passes a tensor with a ControlNet configured with `force_zeros_for_pooled_projection=False`, which is the path that raised. Ref huggingface#13611 (Issue 3), huggingface#9686 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XBYeq5vB4DNZDEaqUsroKR
|
Hi @Devam0311, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Please note that PRs without a linked issue are likely to be automatically closed 10 days after this notice. Once the PR links an issue (or gets the |
|
This PR has been automatically closed because it does not link an issue and the reminder above was not addressed within 10 days. If this PR is still relevant, please link the issue it fixes (e.g. We are experimenting with this process to keep the review queue manageable, and it will sometimes get it wrong. If you think this PR should stay open, please just say so here and we will reopen it — no need to justify it at length. Thanks again for contributing, and sorry for the noise if we closed this by mistake! |
What does this PR do?
Fixes Issue 3 of #13611, which is also reported independently as #9686.
Both SD3 ControlNet pipelines resolve the public
controlnet_pooled_projectionsargument with:orevaluates the truthiness of the left operand, so passing any real pooled projection raises:The documented argument is therefore unusable on that path.
Solution
pipeline_stable_diffusion_3_controlnet.py— replace theorwith an explicitNonecheck:pipeline_stable_diffusion_3_controlnet_inpainting.py— here theelsebranch is guarded byif controlnet_pooled_projections is None, so it is only reachable when the value is notNone. It could therefore only ever re-assign the value to itself or raise. Removed.Testing
test_controlnet_pooled_projections_accepts_tensorbuilds a ControlNet withforce_zeros_for_pooled_projection=False— the configuration that reaches the broken branch — and passes a tensor.Verified it catches the bug: with the fix reverted it fails with the
RuntimeErrorabove; with it applied it passes.Before submitting
self-reviewskill on the diff?Self-review notes
Reviewed against
.ai/references/review-rules.mdandpipelines.md. No blocking issues.For the reviewer:
controlnet_config.force_zeros_for_pooled_projection; the inpainting pipeline instead zeroes whenever the argument isNoneand never consults that flag. The issue's suggested fix would apply the text-to-image logic to both, but that is a behaviour change beyond fixing the crash, so I kept each pipeline's existing semantics. Happy to align them in a follow-up if you want that.Who can review?
@yiyixuxu @asomoza @hlky