diff --git a/tests/modular_pipelines/flux2/test_modular_pipeline_flux2_klein.py b/tests/modular_pipelines/flux2/test_modular_pipeline_flux2_klein.py index 6a6984428d5d..299809b02ca7 100644 --- a/tests/modular_pipelines/flux2/test_modular_pipeline_flux2_klein.py +++ b/tests/modular_pipelines/flux2/test_modular_pipeline_flux2_klein.py @@ -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): @@ -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): diff --git a/tests/modular_pipelines/test_modular_pipelines_common.py b/tests/modular_pipelines/test_modular_pipelines_common.py index 223a25e436fa..5f2004fa31de 100644 --- a/tests/modular_pipelines/test_modular_pipelines_common.py +++ b/tests/modular_pipelines/test_modular_pipelines_common.py @@ -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) @@ -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)