Fix modular branch input defaults#14137
Open
pzarzycki wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes modular pipeline input default handling for ConditionalPipelineBlocks so branch-local defaults don’t get promoted to pipeline-level defaults (and therefore don’t leak into sibling branches before branch selection). This aligns behavior with the intent described in #14132: only defaults that are truly shared across all branches should appear as pipeline-level defaults.
Changes:
- Updated conditional input aggregation to only promote a pipeline-level default when every branch declares the same default for a shared input.
- Adjusted state/input resolution so missing inputs fall back to the selected block’s local default, and
Nonedefaults are not materialized intoPipelineStatebefore branch selection. - Added regression tests covering branch-local default leakage, shared default promotion, and conflicting-default non-promotion.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/diffusers/modular_pipelines/modular_pipeline.py |
Changes how conditional inputs are combined and how defaults are applied so branch-local defaults don’t leak across branches. |
tests/modular_pipelines/test_conditional_pipeline_blocks.py |
Adds focused regression tests for branch-local defaults, shared defaults, and conflicting defaults behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes modular pipeline input default handling so branch-local defaults do not leak across conditional branches.
In
ConditionalPipelineBlocks, pipeline-level defaults are now only exposed when every branch declares the same default for a shared input. If defaults differ across branches, or only some branches declare the input, the pipeline-level default stays unset and the selected branch applies its own local default.This fixes cases where one branch could not distinguish:
PipelineStatebefore branch selectionFixes #14132.
Repro
Minimal shape of the bug:
num_frames=189num_frames=Noneand requires that it stay unset whenactionis providednum_frames=189into state even on theactionbranchactionbranch receivesnum_frames=Noneunless the user explicitly passed itImplementation
src/diffusers/modular_pipelines/modular_pipeline.pyNonedefaults intoPipelineStatedefault_call_parametersNonedefaults not being promotedTests
Ran:
Result:
Additional broader validation surfaced unrelated modular test failures that are not addressed in this PR:
ErnieImagebatch/single parityLTXbatch/single parityHeliosauto CPU offload device mismatch