Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class TestFlux2KleinModularPipelineFast(ModularPipelineTesterMixin):

params = frozenset(["prompt", "height", "width"])
batch_params = frozenset(["prompt"])
not_params = frozenset(["negative_prompt"])
expected_workflow_blocks = FLUX2_KLEIN_WORKFLOWS

def get_dummy_inputs(self, seed=0):
Expand Down Expand Up @@ -94,6 +95,7 @@ class TestFlux2KleinImageConditionedModularPipelineFast(ModularPipelineTesterMix

params = frozenset(["prompt", "height", "width", "image"])
batch_params = frozenset(["prompt", "image"])
not_params = frozenset(["negative_prompt"])
expected_workflow_blocks = FLUX2_KLEIN_IMAGE_CONDITIONED_WORKFLOWS

def get_dummy_inputs(self, seed=0):
Expand Down
9 changes: 9 additions & 0 deletions tests/modular_pipelines/test_modular_pipelines_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ class ModularPipelineTesterMixin:
# of the type of pipeline. They are always optional and have common
# sense default values.
optional_params = frozenset(["num_inference_steps", "num_images_per_prompt", "latents", "output_type"])
# Parameters the pipeline deliberately does NOT accept — e.g. `negative_prompt` on a
# guidance-distilled pipeline. `test_pipeline_call_signature` asserts they are absent,
# so accidentally (re)introducing one fails the test.
not_params = frozenset()
# this is modular specific: generator needs to be a intermediate input because it's mutable
intermediate_params = frozenset(["generator"])
# Output type for the pipeline (e.g., "images" for image pipelines, "videos" for video pipelines)
Expand Down Expand Up @@ -176,6 +180,11 @@ def _check_for_parameters(parameters, expected_parameters, param_type):
_check_for_parameters(self.params, input_parameters, "input")
_check_for_parameters(self.optional_params, optional_parameters, "optional")

unsupported_parameters = {param for param in self.not_params if param in input_parameters}
assert len(unsupported_parameters) == 0, (
f"Parameters declared in `not_params` unexpectedly present in the pipeline inputs: {unsupported_parameters}"
)

def test_inference_batch_consistent(self, batch_sizes=[2], batch_generator=True):
pipe = self.get_pipeline().to(torch_device)

Expand Down
Loading