Skip to content

when an InputParam is both required and has a default: set required = False and warn - #14521

Open
yiyixuxu wants to merge 8 commits into
mainfrom
required-input-no-default
Open

yiyixuxu wants to merge 8 commits into
mainfrom
required-input-no-default

Conversation

@yiyixuxu

@yiyixuxu yiyixuxu commented Aug 17, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #14388, see the issue for more details on the bug.

This PR:

  1. When an InputParam is both required=True and carries a non-None default: InputParam.__post_init__ now keeps the default, treats the input as optional and logs a warning. This matches what the code has always done at runtime, so no pipeline changes behavior. The usual way to hit this is InputParam.template("num_inference_steps", required=True): when the user try to reuse the template for its type hint and description, but want to mark it as required.

  2. Go through every input in the library that was declared both ways and decide explicitly which one it means:

    • num_inference_steps:
      • the set-timesteps blocks keep the plain template default, i.e. optional with default 50: Cosmos3SetTimestepsStep, Cosmos3TransferSetTimestepsStep, MiniMaxH3SetTimestepsStep
      • every block that runs after set-timesteps declares required=True, default=None, since by then the value is always in the state: Cosmos3DenoiseLoopWrapper, Krea2LoopDenoiser, Krea2DenoiseLoopWrapper, LTXLoopDenoiser, LTXImage2VideoLoopDenoiser, LTXDenoiseLoopWrapper, LTX2LoopDenoiser, LTX2DenoiseLoopWrapper, QwenImageDenoiseLoopWrapper, QwenImage21DenoiseLoopWrapper
    • dtype (LTX, LTX-2) and batch_size (LTX): required=True, default=None. They are intermediates always produced upstream, so the default was never used.

Also re-generated the auto docstrings and added a gotcha for the modular tests: I noticed the MiniMax-H3 workflow test explicitly listed num_inference_steps as a required input. That test is meant to be a snapshot of the pipeline's contract (components, configs, inputs with their defaults) so deviations like this get caught, which only works if the table is read back against the other pipelines rather than copied from the code.

@yiyixuxu
yiyixuxu marked this pull request as draft August 17, 2026 21:18
@github-actions github-actions Bot added modular-pipelines size/S PR with diff < 50 LOC labels Aug 17, 2026
@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
yiyixuxu marked this pull request as ready for review October 22, 2026 09:13
yiyixuxu and others added 2 commits October 22, 2026 11:14
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ed, unit test and guide note

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@yiyixuxu
yiyixuxu force-pushed the required-input-no-default branch from 9cc14db to a73e967 Compare October 22, 2026 16:52
@github-actions github-actions Bot added tests fixes-issue size/M PR with diff < 200 LOC and removed size/S PR with diff < 50 LOC labels Oct 22, 2026
yiyixuxu and others added 3 commits October 22, 2026 19:21
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions github-actions Bot removed the tests label Oct 22, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions github-actions Bot added the tests label Oct 23, 2026

@Chessing234 Chessing234 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

the pitfalls list in .ai/references/modular.md numbers two items as 10. the torch.randn note never moved to 11, so the helpers note is 11 instead of 12.

@yiyixuxu yiyixuxu changed the title drop the default of a required InputParam, with a warning when an InputParam is both required and has a default: set required = False and warn Oct 23, 2026
@yiyixuxu
yiyixuxu requested a review from sayakpaul October 23, 2026 03:40

This branch has not been deployed

No deployments
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: required=True is silently ignored when an InputParam carries a default

3 participants