Conversation
`_get_add_time_ids` accepts `negative_crops_coords_top_left` and the aesthetic-score branch uses it, but the other branch built the negative time ids from `crops_coords_top_left`. Callers asking for different positive and negative crop conditioning silently got the positive coordinates in both, so negative micro-conditioning was wrong. Fixed in the SDXL img2img and inpaint pipelines, the modular SDXL img2img conditioning step, and the five pipelines that carry this method via `# Copied from`. Add a regression test asserting the negative time ids carry the negative crop coordinates. Ref huggingface#13610 (Issue 2) 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 2 of #13610 (
stable_diffusion_xlmodel/pipeline review)._get_add_time_idsacceptsnegative_crops_coords_top_left, and the aesthetic-score branch uses it — but the other branch does not:So anyone requesting different positive and negative crop conditioning silently gets the positive crop coordinates on both branches, and negative micro-conditioning is wrong.
Reproduced on
mainwith the script from the issue:Solution
Use
negative_crops_coords_top_left, matching the aesthetic-score branch directly above it and the separate negative_get_add_time_idscall the text-to-image pipeline already makes.The issue names three files. Five more carry this method through
# Copied from, andutils/check_copies.pyrequires them to match, so all eight are updated together:pipeline_stable_diffusion_xl_img2img.py,pipeline_stable_diffusion_xl_inpaint.py,modular_pipelines/stable_diffusion_xl/before_denoise.py# Copied fromthe abovepipeline_controlnet_sd_xl_img2img.py,pipeline_controlnet_union_sd_xl_img2img.py,pipeline_pag_controlnet_sd_xl_img2img.py,pipeline_pag_sd_xl_img2img.py,pipeline_pag_sd_xl_inpaint.pyTesting
test_get_add_time_ids_uses_negative_crops_coords_top_leftasserts the negative time ids carry the negative crop coordinates.It drives the method through a lightweight stand-in rather than the dummy pipeline, as the issue's own reproduction does. The reason is concrete: this branch emits six time ids instead of five, and the dummy UNet's
add_embedding.linear_1is sized for the five-value aesthetic-score layout, so the real dummy pipeline raises on the embedding-dimension check before reaching the logic under test.Verified it catches the bug: with the fix reverted it fails.
Two sets of pre-existing failures in my environment, both reproducing identically on a clean checkout of
mainand unrelated to this change: theTestStableDiffusionXL*PipelineIPAdapterclasses (aModuleNotFoundErrorfrom an optional dependency I don't have installed), and onebefore_denoise.py_get_add_time_idscopy mismatch againstStableDiffusionXLPipeline— a different method from the one changed here.Before submitting
self-reviewskill on the diff?Self-review notes
Reviewed against
.ai/references/review-rules.mdandpipelines.md. No blocking issues.For the reviewer:
negative_crops_coords_top_lefton a non-aesthetic-score model. That is the point — the old output ignored the argument — but it will move pinned outputs for those callers.# Copied from; touching only the three would breakcheck_copies. Happy to split the copies into a follow-up if you'd rather review them separately.Who can review?
@yiyixuxu @asomoza @hlky