Skip to content

Commit 586c8f3

Browse files
committed
Fail on num_inference_steps set for distilled models
1 parent 61230d7 commit 586c8f3

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/diffusers/modular_pipelines/cosmos/before_denoise.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ def expected_components(self) -> list[ComponentSpec]:
945945
@property
946946
def inputs(self) -> list[InputParam]:
947947
return [
948-
InputParam.template("num_inference_steps", required=False),
948+
InputParam.template("num_inference_steps", required=False, default=None),
949949
InputParam(
950950
name="guidance_scale",
951951
type_hint=float,

src/diffusers/modular_pipelines/cosmos/modular_pipeline.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ def resolve_inference_schedule(
105105
"""Resolve step count and guidance for base vs distilled checkpoints."""
106106
if self.is_distilled_checkpoint:
107107
distilled_steps = len(self.distilled_sigmas)
108+
if num_inference_steps is not None and num_inference_steps != distilled_steps:
109+
raise ValueError(
110+
"This is a distilled checkpoint; the step count is fixed by the scheduler's "
111+
f"`fixed_step_sampler_config.t_list` ({distilled_steps} steps). "
112+
f"`num_inference_steps` must be {distilled_steps} or left unset (got {num_inference_steps})."
113+
)
108114
if guidance_scale is not None and guidance_scale != 1.0:
109115
raise ValueError(
110116
"This is a distilled checkpoint; classifier-free guidance is baked into the weights. "

0 commit comments

Comments
 (0)