Skip to content

Modular branch specific defaults#14234

Open
yiyixuxu wants to merge 15 commits into
mainfrom
modular-branch-specific-defaults
Open

Modular branch specific defaults#14234
yiyixuxu wants to merge 15 commits into
mainfrom
modular-branch-specific-defaults

Conversation

@yiyixuxu

@yiyixuxu yiyixuxu commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

fix #14132

related to #14241 (ideally merge #14241 first)

yiyixuxu and others added 2 commits July 18, 2026 18:41
When sibling blocks of a ConditionalPipelineBlocks declare different
defaults for the same input, combine_inputs now merges the default to
None and records the per-block defaults in a new
InputParam.defaults_by_block field, instead of silently promoting the
non-None default. get_block_state falls back to the block's own declared
default when the state value is None, so each branch resolves its own
default when it actually runs and a branch using None as a "user didn't
pass this" sentinel is no longer polluted by a sibling's default.

Docstrings render conflicted defaults as e.g. "defaults to None or 189,
depending on the workflow".

Fixes #14132

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added size/L PR with diff > 200 LOC tests modular-pipelines labels Jul 18, 2026
yiyixuxu and others added 2 commits July 18, 2026 23:28
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
defaults_by_block is a dataclass field so it always exists; the checks
are already inside the hasattr(param, "required") InputParam guard.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

yiyixuxu and others added 3 commits July 19, 2026 00:40
…tion block restructure

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…example

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
strength on img2img (0.3) / inpaint (0.9999), text2img as the None
sentinel branch; drop the separate video fixtures. Also add examples to
the combine_inputs accumulator comments.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added size/M PR with diff < 200 LOC and removed size/L PR with diff > 200 LOC labels Jul 19, 2026
yiyixuxu and others added 2 commits July 19, 2026 01:52
…th output

Assert on state.get("strength") directly (write-back records the branch's
resolved value); cover None-vs-non-None merge with a direct combine_inputs
test instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
block-a/block-b names, whole-list assertions, plus new coverage:
first-occurrence-wins, disagreement records every block, direct nested
prefixing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added size/L PR with diff > 200 LOC and removed size/M PR with diff < 200 LOC labels Jul 19, 2026
yiyixuxu and others added 5 commits July 19, 2026 02:12
…ality

Also group combine_inputs tests under TestConditionalBlocksInputs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
workflow is now a declared intermediate output on the fixture blocks so
each runtime test shows which branch ran; the merge tests also assert
the rendered docstring (nested case covers distinct-value dedupe).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ombine_inputs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…tring

The combine_inputs docstring example is now a fenced code block so
doc-builder doesn't reflow it.

The cosmos3 use_system_prompt docstring change reflects a real behavior
fix this PR makes: the transfer/action branches declare default=True
while the standard text branch declares default=None as a sentinel that
falls back to the default_use_system_prompt config. Previously the
merged default True leaked into state before branch selection, so the
config fallback never fired for the standard workflow; each branch now
resolves its own default and the config is honored again.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mechanical output of utils/modular_auto_docstring.py for the cosmos
files this PR touches; regeneration of the remaining stale pipelines
moved to its own PR.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@yiyixuxu
yiyixuxu force-pushed the modular-branch-specific-defaults branch from b93cd2a to 3a2888f Compare July 19, 2026 08:18
@yiyixuxu
yiyixuxu requested review from dg845 and sayakpaul July 19, 2026 08:22
use_system_prompt (`bool`, *optional*):
Whether to prepend the system prompt. Defaults to the pipeline configuration for standard and action
workflows and to True for transfer.
use_system_prompt (`bool`, *optional*, defaults to True or None, depending on the workflow):

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only this change is related to this PR
. The rest of docstring changes in cosmos folder are because I re-ran the auto docstring command , see #14241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[modular] ensure branch-specific input defaults

2 participants