From dde70958434fd1e3468c1f1a5921330173672032 Mon Sep 17 00:00:00 2001 From: William Berman Date: Sat, 25 Feb 2023 19:14:27 -0800 Subject: [PATCH 1/4] attend and excite batch test causing timeouts --- .../test_stable_diffusion_attend_and_excite.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/pipelines/stable_diffusion_2/test_stable_diffusion_attend_and_excite.py b/tests/pipelines/stable_diffusion_2/test_stable_diffusion_attend_and_excite.py index 1025b52636a6..ca300dc0ce11 100644 --- a/tests/pipelines/stable_diffusion_2/test_stable_diffusion_attend_and_excite.py +++ b/tests/pipelines/stable_diffusion_2/test_stable_diffusion_attend_and_excite.py @@ -135,8 +135,9 @@ def test_inference(self): max_diff = np.abs(image_slice.flatten() - expected_slice).max() self.assertLessEqual(max_diff, 1e-3) - def test_inference_batch_single_identical(self): - self._test_inference_batch_single_identical(relax_max_difference=False) + def test_inference_batch_consistent(self): + # NOTE: Larger batch sizes cause this test to timeout, only test on smaller batches + self._test_inference_batch_consistent(batch_sizes=[2, 4]) @require_torch_gpu From e788d121eac5da446d49f2cfa0c665b4675574ad Mon Sep 17 00:00:00 2001 From: William Berman Date: Sun, 26 Feb 2023 01:40:48 -0800 Subject: [PATCH 2/4] PipelineTesterMixin argument configuration refactor --- tests/pipeline_params.py | 104 +++++++++++++++ .../altdiffusion/test_alt_diffusion.py | 3 + .../dance_diffusion/test_dance_diffusion.py | 11 ++ tests/pipelines/ddim/test_ddim.py | 9 ++ tests/pipelines/dit/test_dit.py | 13 ++ .../latent_diffusion/test_latent_diffusion.py | 13 ++ .../paint_by_example/test_paint_by_example.py | 9 +- tests/pipelines/repaint/test_repaint.py | 9 ++ .../stable_diffusion/test_cycle_diffusion.py | 9 ++ .../stable_diffusion/test_stable_diffusion.py | 3 + .../test_stable_diffusion_image_variation.py | 3 + .../test_stable_diffusion_img2img.py | 4 + .../test_stable_diffusion_inpaint.py | 3 + ...st_stable_diffusion_instruction_pix2pix.py | 3 + .../test_stable_diffusion_panorama.py | 3 + .../test_stable_diffusion_pix2pix_zero.py | 3 + .../test_stable_diffusion_sag.py | 3 + .../test_stable_diffusion.py | 3 + ...test_stable_diffusion_attend_and_excite.py | 3 + .../test_stable_diffusion_depth.py | 4 + .../test_stable_diffusion_inpaint.py | 3 + .../test_stable_diffusion_latent_upscale.py | 10 ++ .../stable_unclip/test_stable_unclip.py | 3 + .../test_stable_unclip_img2img.py | 8 +- tests/pipelines/unclip/test_unclip.py | 43 +++++-- .../unclip/test_unclip_image_variation.py | 29 ++++- tests/test_pipelines_common.py | 120 +++++++++++++----- 27 files changed, 377 insertions(+), 54 deletions(-) create mode 100644 tests/pipeline_params.py diff --git a/tests/pipeline_params.py b/tests/pipeline_params.py new file mode 100644 index 000000000000..2703801d4a7d --- /dev/null +++ b/tests/pipeline_params.py @@ -0,0 +1,104 @@ +# These are canonical sets of parameters for different types of pipelines. +# They are set on subclasses of `PipelineTesterMixin` as `params` and +# `batch_params`. +# +# If a pipeline's set of arguments has minor changes from one of the common sets +# of arguments, do not make modifications to the existing common sets of arguments. +# I.e. a text to image pipeline with non-configurable height and width arguments +# should set its attribute as `params = TEXT_TO_IMAGE_PARAMS - {'height', 'width'}`. + +TEXT_TO_IMAGE_PARAMS = frozenset( + [ + "prompt", + "height", + "width", + "guidance_scale", + "negative_prompt", + "prompt_embeds", + "negative_prompt_embeds", + "cross_attention_kwargs", + ] +) + +TEXT_TO_IMAGE_BATCH_PARAMS = frozenset(["prompt", "negative_prompt"]) + +IMAGE_VARIATION_PARAMS = frozenset( + [ + "image", + "height", + "width", + "guidance_scale", + ] +) + +IMAGE_VARIATION_BATCH_PARAMS = frozenset(["image"]) + +TEXT_GUIDED_IMAGE_VARIATION_PARAMS = frozenset( + [ + "prompt", + "image", + "height", + "width", + "guidance_scale", + "negative_prompt", + "prompt_embeds", + "negative_prompt_embeds", + ] +) + +TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS = frozenset(["prompt", "image", "negative_prompt"]) + +TEXT_GUIDED_IMAGE_INPAINTING_PARAMS = frozenset( + [ + # Text guided image variation with an image mask + "prompt", + "image", + "mask_image", + "height", + "width", + "guidance_scale", + "negative_prompt", + "prompt_embeds", + "negative_prompt_embeds", + ] +) + +TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS = frozenset(["prompt", "image", "mask_image", "negative_prompt"]) + +IMAGE_INPAINTING_PARAMS = frozenset( + [ + # image variation with an image mask + "image", + "mask_image", + "height", + "width", + "guidance_scale", + ] +) + +IMAGE_INPAINTING_BATCH_PARAMS = frozenset(["image", "mask_image"]) + +IMAGE_GUIDED_IMAGE_INPAINTING_PARAMS = frozenset( + [ + "example_image", + "image", + "mask_image", + "height", + "width", + "guidance_scale", + ] +) + +IMAGE_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS = frozenset(["example_image", "image", "mask_image"]) + +CLASS_CONDITIONED_IMAGE_GENERATION_PARAMS = frozenset(["class_labels"]) + +CLASS_CONDITIONED_IMAGE_GENERATION_BATCH_PARAMS = frozenset(["class_labels"]) + +UNCONDITIONAL_IMAGE_GENERATION_PARAMS = frozenset(["batch_size"]) + +UNCONDITIONAL_IMAGE_GENERATION_BATCH_PARAMS = frozenset([]) + +UNCONDITIONAL_AUDIO_GENERATION_PARAMS = frozenset(["batch_size"]) + +UNCONDITIONAL_AUDIO_GENERATION_BATCH_PARAMS = frozenset([]) diff --git a/tests/pipelines/altdiffusion/test_alt_diffusion.py b/tests/pipelines/altdiffusion/test_alt_diffusion.py index 1740e9af382f..68db5249251e 100644 --- a/tests/pipelines/altdiffusion/test_alt_diffusion.py +++ b/tests/pipelines/altdiffusion/test_alt_diffusion.py @@ -28,6 +28,7 @@ from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu +from ...pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -36,6 +37,8 @@ class AltDiffusionPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = AltDiffusionPipeline + params = TEXT_TO_IMAGE_PARAMS + batch_params = TEXT_TO_IMAGE_BATCH_PARAMS def get_dummy_components(self): torch.manual_seed(0) diff --git a/tests/pipelines/dance_diffusion/test_dance_diffusion.py b/tests/pipelines/dance_diffusion/test_dance_diffusion.py index 08ca2e0bee30..b86dab0d0c37 100644 --- a/tests/pipelines/dance_diffusion/test_dance_diffusion.py +++ b/tests/pipelines/dance_diffusion/test_dance_diffusion.py @@ -23,6 +23,7 @@ from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu +from ...pipeline_params import UNCONDITIONAL_AUDIO_GENERATION_BATCH_PARAMS, UNCONDITIONAL_AUDIO_GENERATION_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -31,6 +32,16 @@ class DanceDiffusionPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = DanceDiffusionPipeline + params = UNCONDITIONAL_AUDIO_GENERATION_PARAMS + required_optional_params = PipelineTesterMixin.required_optional_params - { + "callback", + "latents", + "callback_steps", + "output_type", + "eta", + "num_images_per_prompt", + } + batch_params = UNCONDITIONAL_AUDIO_GENERATION_BATCH_PARAMS test_attention_slicing = False test_cpu_offload = False diff --git a/tests/pipelines/ddim/test_ddim.py b/tests/pipelines/ddim/test_ddim.py index 300e7217f8c3..686f14f62913 100644 --- a/tests/pipelines/ddim/test_ddim.py +++ b/tests/pipelines/ddim/test_ddim.py @@ -21,6 +21,7 @@ from diffusers import DDIMPipeline, DDIMScheduler, UNet2DModel from diffusers.utils.testing_utils import require_torch_gpu, slow, torch_device +from ...pipeline_params import UNCONDITIONAL_IMAGE_GENERATION_BATCH_PARAMS, UNCONDITIONAL_IMAGE_GENERATION_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -29,6 +30,14 @@ class DDIMPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = DDIMPipeline + params = UNCONDITIONAL_IMAGE_GENERATION_PARAMS + required_optional_params = PipelineTesterMixin.required_optional_params - { + "num_images_per_prompt", + "latents", + "callback", + "callback_steps", + } + batch_params = UNCONDITIONAL_IMAGE_GENERATION_BATCH_PARAMS test_cpu_offload = False def get_dummy_components(self): diff --git a/tests/pipelines/dit/test_dit.py b/tests/pipelines/dit/test_dit.py index f1838ebef05d..230d315c2bba 100644 --- a/tests/pipelines/dit/test_dit.py +++ b/tests/pipelines/dit/test_dit.py @@ -23,6 +23,10 @@ from diffusers.utils import load_numpy, slow from diffusers.utils.testing_utils import require_torch_gpu +from ...pipeline_params import ( + CLASS_CONDITIONED_IMAGE_GENERATION_BATCH_PARAMS, + CLASS_CONDITIONED_IMAGE_GENERATION_PARAMS, +) from ...test_pipelines_common import PipelineTesterMixin @@ -31,6 +35,15 @@ class DiTPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = DiTPipeline + params = CLASS_CONDITIONED_IMAGE_GENERATION_PARAMS + required_optional_params = PipelineTesterMixin.required_optional_params - { + "latents", + "num_images_per_prompt", + "eta", + "callback", + "callback_steps", + } + batch_params = CLASS_CONDITIONED_IMAGE_GENERATION_BATCH_PARAMS test_cpu_offload = False def get_dummy_components(self): diff --git a/tests/pipelines/latent_diffusion/test_latent_diffusion.py b/tests/pipelines/latent_diffusion/test_latent_diffusion.py index 24d75068af29..25ce7fb7b613 100644 --- a/tests/pipelines/latent_diffusion/test_latent_diffusion.py +++ b/tests/pipelines/latent_diffusion/test_latent_diffusion.py @@ -23,6 +23,7 @@ from diffusers import AutoencoderKL, DDIMScheduler, LDMTextToImagePipeline, UNet2DConditionModel from diffusers.utils.testing_utils import load_numpy, nightly, require_torch_gpu, slow, torch_device +from ...pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -31,6 +32,18 @@ class LDMTextToImagePipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = LDMTextToImagePipeline + params = TEXT_TO_IMAGE_PARAMS - { + "negative_prompt", + "negative_prompt_embeds", + "cross_attention_kwargs", + "prompt_embeds", + } + required_optional_params = PipelineTesterMixin.required_optional_params - { + "num_images_per_prompt", + "callback", + "callback_steps", + } + batch_params = TEXT_TO_IMAGE_BATCH_PARAMS test_cpu_offload = False def get_dummy_components(self): diff --git a/tests/pipelines/paint_by_example/test_paint_by_example.py b/tests/pipelines/paint_by_example/test_paint_by_example.py index a2e04d20a067..691ebac5dbc4 100644 --- a/tests/pipelines/paint_by_example/test_paint_by_example.py +++ b/tests/pipelines/paint_by_example/test_paint_by_example.py @@ -27,6 +27,7 @@ from diffusers.utils import floats_tensor, load_image, slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu +from ...pipeline_params import IMAGE_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS, IMAGE_GUIDED_IMAGE_INPAINTING_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -35,12 +36,8 @@ class PaintByExamplePipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = PaintByExamplePipeline - - def tearDown(self): - # clean up the VRAM after each test - super().tearDown() - gc.collect() - torch.cuda.empty_cache() + params = IMAGE_GUIDED_IMAGE_INPAINTING_PARAMS + batch_params = IMAGE_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS def get_dummy_components(self): torch.manual_seed(0) diff --git a/tests/pipelines/repaint/test_repaint.py b/tests/pipelines/repaint/test_repaint.py index f1beea00a01d..c0a091cd821e 100644 --- a/tests/pipelines/repaint/test_repaint.py +++ b/tests/pipelines/repaint/test_repaint.py @@ -22,6 +22,7 @@ from diffusers import RePaintPipeline, RePaintScheduler, UNet2DModel from diffusers.utils.testing_utils import load_image, load_numpy, nightly, require_torch_gpu, torch_device +from ...pipeline_params import IMAGE_INPAINTING_BATCH_PARAMS, IMAGE_INPAINTING_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -30,6 +31,14 @@ class RepaintPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = RePaintPipeline + params = IMAGE_INPAINTING_PARAMS - {"width", "height", "guidance_scale"} + required_optional_params = PipelineTesterMixin.required_optional_params - { + "latents", + "num_images_per_prompt", + "callback", + "callback_steps", + } + batch_params = IMAGE_INPAINTING_BATCH_PARAMS test_cpu_offload = False def get_dummy_components(self): diff --git a/tests/pipelines/stable_diffusion/test_cycle_diffusion.py b/tests/pipelines/stable_diffusion/test_cycle_diffusion.py index 948a39786dcb..279941f4040b 100644 --- a/tests/pipelines/stable_diffusion/test_cycle_diffusion.py +++ b/tests/pipelines/stable_diffusion/test_cycle_diffusion.py @@ -25,6 +25,7 @@ from diffusers.utils import floats_tensor, load_image, load_numpy, slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu +from ...pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -33,6 +34,14 @@ class CycleDiffusionPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = CycleDiffusionPipeline + params = TEXT_GUIDED_IMAGE_VARIATION_PARAMS - { + "negative_prompt", + "height", + "width", + "negative_prompt_embeds", + } + required_optional_params = PipelineTesterMixin.required_optional_params - {"latents"} + batch_params = TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS def get_dummy_components(self): torch.manual_seed(0) diff --git a/tests/pipelines/stable_diffusion/test_stable_diffusion.py b/tests/pipelines/stable_diffusion/test_stable_diffusion.py index 75e2a44f018f..7ba076bbda5a 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion.py @@ -39,6 +39,7 @@ from diffusers.utils.testing_utils import CaptureLogger, require_torch_gpu from ...models.test_models_unet_2d_condition import create_lora_layers +from ...pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -47,6 +48,8 @@ class StableDiffusionPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = StableDiffusionPipeline + params = TEXT_TO_IMAGE_PARAMS + batch_params = TEXT_TO_IMAGE_BATCH_PARAMS def get_dummy_components(self): torch.manual_seed(0) diff --git a/tests/pipelines/stable_diffusion/test_stable_diffusion_image_variation.py b/tests/pipelines/stable_diffusion/test_stable_diffusion_image_variation.py index a7aa4051774d..182f0f2aee50 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_image_variation.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_image_variation.py @@ -32,6 +32,7 @@ from diffusers.utils import floats_tensor, load_image, load_numpy, nightly, slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu +from ...pipeline_params import IMAGE_VARIATION_BATCH_PARAMS, IMAGE_VARIATION_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -40,6 +41,8 @@ class StableDiffusionImageVariationPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = StableDiffusionImageVariationPipeline + params = IMAGE_VARIATION_PARAMS + batch_params = IMAGE_VARIATION_BATCH_PARAMS def get_dummy_components(self): torch.manual_seed(0) diff --git a/tests/pipelines/stable_diffusion/test_stable_diffusion_img2img.py b/tests/pipelines/stable_diffusion/test_stable_diffusion_img2img.py index e10b608734b6..eebd19ef26a4 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_img2img.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_img2img.py @@ -33,6 +33,7 @@ from diffusers.utils import floats_tensor, load_image, load_numpy, nightly, slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu +from ...pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -41,6 +42,9 @@ class StableDiffusionImg2ImgPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = StableDiffusionImg2ImgPipeline + params = TEXT_GUIDED_IMAGE_VARIATION_PARAMS - {"height", "width"} + required_optional_params = PipelineTesterMixin.required_optional_params - {"latents"} + batch_params = TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS def get_dummy_components(self): torch.manual_seed(0) diff --git a/tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint.py b/tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint.py index c44101d13c5a..af26a89ab0c7 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint.py @@ -34,6 +34,7 @@ from diffusers.utils import floats_tensor, load_image, load_numpy, nightly, slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu +from ...pipeline_params import TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS, TEXT_GUIDED_IMAGE_INPAINTING_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -42,6 +43,8 @@ class StableDiffusionInpaintPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = StableDiffusionInpaintPipeline + params = TEXT_GUIDED_IMAGE_INPAINTING_PARAMS + batch_params = TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS def get_dummy_components(self): torch.manual_seed(0) diff --git a/tests/pipelines/stable_diffusion/test_stable_diffusion_instruction_pix2pix.py b/tests/pipelines/stable_diffusion/test_stable_diffusion_instruction_pix2pix.py index 4c232b573b4f..d548ae15dfe9 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_instruction_pix2pix.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_instruction_pix2pix.py @@ -34,6 +34,7 @@ from diffusers.utils import floats_tensor, load_image, slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu +from ...pipeline_params import TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -42,6 +43,8 @@ class StableDiffusionInstructPix2PixPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = StableDiffusionInstructPix2PixPipeline + params = TEXT_GUIDED_IMAGE_VARIATION_PARAMS - {"height", "width", "cross_attention_kwargs"} + batch_params = TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS def get_dummy_components(self): torch.manual_seed(0) diff --git a/tests/pipelines/stable_diffusion/test_stable_diffusion_panorama.py b/tests/pipelines/stable_diffusion/test_stable_diffusion_panorama.py index 366cd39da53a..16e6cb0957d2 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_panorama.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_panorama.py @@ -32,6 +32,7 @@ from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu, skip_mps +from ...pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -41,6 +42,8 @@ @skip_mps class StableDiffusionPanoramaPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = StableDiffusionPanoramaPipeline + params = TEXT_TO_IMAGE_PARAMS + batch_params = TEXT_TO_IMAGE_BATCH_PARAMS def get_dummy_components(self): torch.manual_seed(0) diff --git a/tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py b/tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py index 103430aefb91..09dc705c5911 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py @@ -35,6 +35,7 @@ from diffusers.utils import load_numpy, slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu, skip_mps +from ...pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -50,6 +51,8 @@ def download_from_url(embedding_url, local_filepath): @skip_mps class StableDiffusionPix2PixZeroPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = StableDiffusionPix2PixZeroPipeline + params = TEXT_GUIDED_IMAGE_VARIATION_PARAMS + batch_params = TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS def get_dummy_components(self): torch.manual_seed(0) diff --git a/tests/pipelines/stable_diffusion/test_stable_diffusion_sag.py b/tests/pipelines/stable_diffusion/test_stable_diffusion_sag.py index f21a0af5c56f..69f347cdbc4c 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_sag.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_sag.py @@ -29,6 +29,7 @@ from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu +from ...pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -37,6 +38,8 @@ class StableDiffusionSAGPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = StableDiffusionSAGPipeline + params = TEXT_TO_IMAGE_PARAMS + batch_params = TEXT_TO_IMAGE_BATCH_PARAMS test_cpu_offload = False def get_dummy_components(self): diff --git a/tests/pipelines/stable_diffusion_2/test_stable_diffusion.py b/tests/pipelines/stable_diffusion_2/test_stable_diffusion.py index 4657bf274401..85fb9bc52355 100644 --- a/tests/pipelines/stable_diffusion_2/test_stable_diffusion.py +++ b/tests/pipelines/stable_diffusion_2/test_stable_diffusion.py @@ -35,6 +35,7 @@ from diffusers.utils import load_numpy, nightly, slow, torch_device from diffusers.utils.testing_utils import CaptureLogger, require_torch_gpu +from ...pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -43,6 +44,8 @@ class StableDiffusion2PipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = StableDiffusionPipeline + params = TEXT_TO_IMAGE_PARAMS + batch_params = TEXT_TO_IMAGE_BATCH_PARAMS def get_dummy_components(self): torch.manual_seed(0) diff --git a/tests/pipelines/stable_diffusion_2/test_stable_diffusion_attend_and_excite.py b/tests/pipelines/stable_diffusion_2/test_stable_diffusion_attend_and_excite.py index ca300dc0ce11..b0673eb93b7b 100644 --- a/tests/pipelines/stable_diffusion_2/test_stable_diffusion_attend_and_excite.py +++ b/tests/pipelines/stable_diffusion_2/test_stable_diffusion_attend_and_excite.py @@ -29,6 +29,7 @@ from diffusers.utils import load_numpy, skip_mps, slow from diffusers.utils.testing_utils import require_torch_gpu +from ...pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -36,6 +37,8 @@ class StableDiffusionAttendAndExcitePipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = StableDiffusionAttendAndExcitePipeline test_attention_slicing = False + params = TEXT_TO_IMAGE_PARAMS + batch_params = TEXT_TO_IMAGE_BATCH_PARAMS.union({"token_indices"}) def get_dummy_components(self): torch.manual_seed(0) diff --git a/tests/pipelines/stable_diffusion_2/test_stable_diffusion_depth.py b/tests/pipelines/stable_diffusion_2/test_stable_diffusion_depth.py index 0bcd2de62982..8b9593e277a7 100644 --- a/tests/pipelines/stable_diffusion_2/test_stable_diffusion_depth.py +++ b/tests/pipelines/stable_diffusion_2/test_stable_diffusion_depth.py @@ -42,6 +42,7 @@ from diffusers.utils import floats_tensor, is_accelerate_available, load_image, load_numpy, nightly, slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu, skip_mps +from ...pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -52,6 +53,9 @@ class StableDiffusionDepth2ImgPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = StableDiffusionDepth2ImgPipeline test_save_load_optional_components = False + params = TEXT_GUIDED_IMAGE_VARIATION_PARAMS - {"height", "width"} + required_optional_params = PipelineTesterMixin.required_optional_params - {"latents"} + batch_params = TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS def get_dummy_components(self): torch.manual_seed(0) diff --git a/tests/pipelines/stable_diffusion_2/test_stable_diffusion_inpaint.py b/tests/pipelines/stable_diffusion_2/test_stable_diffusion_inpaint.py index 58bdd465e422..fefdda6173e7 100644 --- a/tests/pipelines/stable_diffusion_2/test_stable_diffusion_inpaint.py +++ b/tests/pipelines/stable_diffusion_2/test_stable_diffusion_inpaint.py @@ -26,6 +26,7 @@ from diffusers.utils import floats_tensor, load_image, load_numpy, torch_device from diffusers.utils.testing_utils import require_torch_gpu, slow +from ...pipeline_params import TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS, TEXT_GUIDED_IMAGE_INPAINTING_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -34,6 +35,8 @@ class StableDiffusion2InpaintPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = StableDiffusionInpaintPipeline + params = TEXT_GUIDED_IMAGE_INPAINTING_PARAMS + batch_params = TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS def get_dummy_components(self): torch.manual_seed(0) diff --git a/tests/pipelines/stable_diffusion_2/test_stable_diffusion_latent_upscale.py b/tests/pipelines/stable_diffusion_2/test_stable_diffusion_latent_upscale.py index d17c9eb5c513..f2c3822b8d2c 100644 --- a/tests/pipelines/stable_diffusion_2/test_stable_diffusion_latent_upscale.py +++ b/tests/pipelines/stable_diffusion_2/test_stable_diffusion_latent_upscale.py @@ -31,6 +31,7 @@ from diffusers.utils import floats_tensor, load_image, load_numpy, slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu +from ...pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS from ...test_pipelines_common import PipelineTesterMixin @@ -39,6 +40,15 @@ class StableDiffusionLatentUpscalePipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = StableDiffusionLatentUpscalePipeline + params = TEXT_GUIDED_IMAGE_VARIATION_PARAMS - { + "height", + "width", + "cross_attention_kwargs", + "negative_prompt_embeds", + "prompt_embeds", + } + required_optional_params = PipelineTesterMixin.required_optional_params - {"num_images_per_prompt", "eta"} + batch_params = TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS test_cpu_offload = True @property diff --git a/tests/pipelines/stable_unclip/test_stable_unclip.py b/tests/pipelines/stable_unclip/test_stable_unclip.py index 4b69a03fc5a8..368ab21f24a9 100644 --- a/tests/pipelines/stable_unclip/test_stable_unclip.py +++ b/tests/pipelines/stable_unclip/test_stable_unclip.py @@ -15,11 +15,14 @@ from diffusers.pipelines.stable_diffusion.stable_unclip_image_normalizer import StableUnCLIPImageNormalizer from diffusers.utils.testing_utils import load_numpy, require_torch_gpu, slow, torch_device +from ...pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS from ...test_pipelines_common import PipelineTesterMixin, assert_mean_pixel_difference class StableUnCLIPPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = StableUnCLIPPipeline + params = TEXT_TO_IMAGE_PARAMS + batch_params = TEXT_TO_IMAGE_BATCH_PARAMS # TODO(will) Expected attn_bias.stride(1) == 0 to be true, but got false test_xformers_attention = False diff --git a/tests/pipelines/stable_unclip/test_stable_unclip_img2img.py b/tests/pipelines/stable_unclip/test_stable_unclip_img2img.py index 539e0dcebe1e..1db8c3801007 100644 --- a/tests/pipelines/stable_unclip/test_stable_unclip_img2img.py +++ b/tests/pipelines/stable_unclip/test_stable_unclip_img2img.py @@ -18,11 +18,17 @@ from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import floats_tensor, load_image, load_numpy, require_torch_gpu, slow, torch_device -from ...test_pipelines_common import PipelineTesterMixin, assert_mean_pixel_difference +from ...pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS +from ...test_pipelines_common import ( + PipelineTesterMixin, + assert_mean_pixel_difference, +) class StableUnCLIPImg2ImgPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = StableUnCLIPImg2ImgPipeline + params = TEXT_GUIDED_IMAGE_VARIATION_PARAMS + batch_params = TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS def get_dummy_components(self): embedder_hidden_size = 32 diff --git a/tests/pipelines/unclip/test_unclip.py b/tests/pipelines/unclip/test_unclip.py index 20807f11699c..6335d6e8e1aa 100644 --- a/tests/pipelines/unclip/test_unclip.py +++ b/tests/pipelines/unclip/test_unclip.py @@ -25,13 +25,22 @@ from diffusers.utils import load_numpy, nightly, slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu, skip_mps +from ...pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS from ...test_pipelines_common import PipelineTesterMixin, assert_mean_pixel_difference class UnCLIPPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = UnCLIPPipeline - test_xformers_attention = False - + params = TEXT_TO_IMAGE_PARAMS - { + "negative_prompt", + "height", + "width", + "negative_prompt_embeds", + "guidance_scale", + "prompt_embeds", + "cross_attention_kwargs", + } + batch_params = TEXT_TO_IMAGE_BATCH_PARAMS required_optional_params = [ "generator", "return_dict", @@ -39,11 +48,7 @@ class UnCLIPPipelineFastTests(PipelineTesterMixin, unittest.TestCase): "decoder_num_inference_steps", "super_res_num_inference_steps", ] - num_inference_steps_args = [ - "prior_num_inference_steps", - "decoder_num_inference_steps", - "super_res_num_inference_steps", - ] + test_xformers_attention = False @property def text_embedder_hidden_size(self): @@ -361,18 +366,36 @@ def test_attention_slicing_forward_pass(self): def test_inference_batch_single_identical(self): test_max_difference = torch_device == "cpu" relax_max_difference = True + additional_params_copy_to_batched_inputs = [ + "prior_num_inference_steps", + "decoder_num_inference_steps", + "super_res_num_inference_steps", + ] self._test_inference_batch_single_identical( - test_max_difference=test_max_difference, relax_max_difference=relax_max_difference + test_max_difference=test_max_difference, + relax_max_difference=relax_max_difference, + additional_params_copy_to_batched_inputs=additional_params_copy_to_batched_inputs, ) def test_inference_batch_consistent(self): + additional_params_copy_to_batched_inputs = [ + "prior_num_inference_steps", + "decoder_num_inference_steps", + "super_res_num_inference_steps", + ] + if torch_device == "mps": # TODO: MPS errors with larger batch sizes batch_sizes = [2, 3] - self._test_inference_batch_consistent(batch_sizes=batch_sizes) + self._test_inference_batch_consistent( + batch_sizes=batch_sizes, + additional_params_copy_to_batched_inputs=additional_params_copy_to_batched_inputs, + ) else: - self._test_inference_batch_consistent() + self._test_inference_batch_consistent( + additional_params_copy_to_batched_inputs=additional_params_copy_to_batched_inputs + ) @skip_mps def test_dict_tuple_outputs_equivalent(self): diff --git a/tests/pipelines/unclip/test_unclip_image_variation.py b/tests/pipelines/unclip/test_unclip_image_variation.py index 865cf11dd825..746143301ea5 100644 --- a/tests/pipelines/unclip/test_unclip_image_variation.py +++ b/tests/pipelines/unclip/test_unclip_image_variation.py @@ -39,11 +39,14 @@ from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing_utils import load_image, require_torch_gpu, skip_mps +from ...pipeline_params import IMAGE_VARIATION_BATCH_PARAMS, IMAGE_VARIATION_PARAMS from ...test_pipelines_common import PipelineTesterMixin, assert_mean_pixel_difference class UnCLIPImageVariationPipelineFastTests(PipelineTesterMixin, unittest.TestCase): pipeline_class = UnCLIPImageVariationPipeline + params = IMAGE_VARIATION_PARAMS - {"height", "width", "guidance_scale"} + batch_params = IMAGE_VARIATION_BATCH_PARAMS required_optional_params = [ "generator", @@ -51,10 +54,6 @@ class UnCLIPImageVariationPipelineFastTests(PipelineTesterMixin, unittest.TestCa "decoder_num_inference_steps", "super_res_num_inference_steps", ] - num_inference_steps_args = [ - "decoder_num_inference_steps", - "super_res_num_inference_steps", - ] @property def text_embedder_hidden_size(self): @@ -482,18 +481,34 @@ def test_attention_slicing_forward_pass(self): def test_inference_batch_single_identical(self): test_max_difference = torch_device == "cpu" relax_max_difference = True + additional_params_copy_to_batched_inputs = [ + "decoder_num_inference_steps", + "super_res_num_inference_steps", + ] self._test_inference_batch_single_identical( - test_max_difference=test_max_difference, relax_max_difference=relax_max_difference + test_max_difference=test_max_difference, + relax_max_difference=relax_max_difference, + additional_params_copy_to_batched_inputs=additional_params_copy_to_batched_inputs, ) def test_inference_batch_consistent(self): + additional_params_copy_to_batched_inputs = [ + "decoder_num_inference_steps", + "super_res_num_inference_steps", + ] + if torch_device == "mps": # TODO: MPS errors with larger batch sizes batch_sizes = [2, 3] - self._test_inference_batch_consistent(batch_sizes=batch_sizes) + self._test_inference_batch_consistent( + batch_sizes=batch_sizes, + additional_params_copy_to_batched_inputs=additional_params_copy_to_batched_inputs, + ) else: - self._test_inference_batch_consistent() + self._test_inference_batch_consistent( + additional_params_copy_to_batched_inputs=additional_params_copy_to_batched_inputs + ) @skip_mps def test_dict_tuple_outputs_equivalent(self): diff --git a/tests/test_pipelines_common.py b/tests/test_pipelines_common.py index 7c145be21b34..c49aba5eeb18 100644 --- a/tests/test_pipelines_common.py +++ b/tests/test_pipelines_common.py @@ -35,17 +35,22 @@ class PipelineTesterMixin: equivalence of dict and tuple outputs, etc. """ - allowed_required_args = [ - "source_prompt", - "prompt", - "image", - "mask_image", - "example_image", - "class_labels", - "token_indices", - ] - required_optional_params = ["generator", "num_inference_steps", "return_dict"] - num_inference_steps_args = ["num_inference_steps"] + # Canonical parameters that are passed to `__call__` regardless + # of the type of pipeline. They are always optional and have common + # sense default values. + required_optional_params = frozenset( + [ + "num_inference_steps", + "num_images_per_prompt", + "eta", + "generator", + "latents", + "output_type", + "return_dict", + "callback", + "callback_steps", + ] + ) # set these parameters to False in the child class if the pipeline does not support the corresponding functionality test_attention_slicing = True @@ -76,6 +81,35 @@ def get_dummy_inputs(self, device, seed=0): "See existing pipeline tests for reference." ) + @property + def params(self) -> frozenset: + raise NotImplementedError( + "You need to set the attribute `params` in the child test class. " + "`params` are checked if they can be passed to `__call__`. " + "`params` are used for families of pipelines that have common parameters such as text to " + "image pipelines for prompts and prompt embedding overrides. `pipeline_params.py` provides " + "some common sets of parameters such as `TEXT_TO_IMAGE_PARAMS`, `IMAGE_VARIATION_PARAMS`, etc... " + "If your pipeline's set of arguments has minor changes from one of the common sets of arguments, " + "do not make modifications to the existing common sets of arguments. I.e. a text to image pipeline " + "with non-configurable height and width arguments should set the attribute as " + "`params = TEXT_TO_IMAGE_PARAMS - {'height', 'width'}`. " + "See existing pipeline tests for reference." + ) + + @property + def batch_params(self) -> frozenset: + raise NotImplementedError( + "You need to set the attribute `batch_params` in the child test class. " + "`batch_params` are the parameters required to be batched when passed to the pipeline's " + "`__call__` method. `pipeline_params.py` provides some common sets of parameters such as " + "`TEXT_TO_IMAGE_BATCH_PARAMS`, `IMAGE_VARIATION_BATCH_PARAMS`, etc... If your pipeline's " + "set of batch arguments has minor changes from one of the common sets of batch arguments, " + "do not make modifications to the existing common sets of batch arguments. I.e. a text to " + "image pipeline `negative_prompt` is not batched should set the attribute as " + "`batch_params = TEXT_TO_IMAGE_BATCH_PARAMS - {'negative_prompt'}`. " + "See existing pipeline tests for reference." + ) + def tearDown(self): # clean up the VRAM after each test in case of CUDA runtime errors super().tearDown() @@ -116,29 +150,51 @@ def test_save_load_local(self): max_diff = np.abs(output - output_loaded).max() self.assertLess(max_diff, 1e-4) - def test_pipeline_call_implements_required_args(self): - assert hasattr(self.pipeline_class, "__call__"), f"{self.pipeline_class} should have a `__call__` method" + def test_pipeline_call_signature(self): + self.assertTrue( + hasattr(self.pipeline_class, "__call__"), f"{self.pipeline_class} should have a `__call__` method" + ) + parameters = inspect.signature(self.pipeline_class.__call__).parameters - required_parameters = {k: v for k, v in parameters.items() if v.default == inspect._empty} - required_parameters.pop("self") - required_parameters = set(required_parameters) - optional_parameters = set({k for k, v in parameters.items() if v.default != inspect._empty}) - for param in required_parameters: - if param == "kwargs": - # kwargs can be added if arguments of pipeline call function are deprecated - continue - assert param in self.allowed_required_args + optional_parameters = set() + + for k, v in parameters.items(): + if v.default != inspect._empty: + optional_parameters.add(k) - optional_parameters = set({k for k, v in parameters.items() if v.default != inspect._empty}) + parameters = set(parameters.keys()) + parameters.remove("self") + parameters.discard("kwargs") # kwargs can be added if arguments of pipeline call function are deprecated + + remaining_required_parameters = set() + + for param in self.params: + if param not in parameters: + remaining_required_parameters.add(param) + + self.assertTrue( + len(remaining_required_parameters) == 0, + f"Required parameters not present: {remaining_required_parameters}", + ) + + remaining_required_optional_parameters = set() for param in self.required_optional_params: - assert param in optional_parameters + if param not in optional_parameters: + remaining_required_optional_parameters.add(param) + + self.assertTrue( + len(remaining_required_optional_parameters) == 0, + f"Required optional parameters not present: {remaining_required_optional_parameters}", + ) def test_inference_batch_consistent(self): self._test_inference_batch_consistent() - def _test_inference_batch_consistent(self, batch_sizes=[2, 4, 13]): + def _test_inference_batch_consistent( + self, batch_sizes=[2, 4, 13], additional_params_copy_to_batched_inputs=["num_inference_steps"] + ): components = self.get_dummy_components() pipe = self.pipeline_class(**components) pipe.to(torch_device) @@ -153,7 +209,7 @@ def _test_inference_batch_consistent(self, batch_sizes=[2, 4, 13]): for batch_size in batch_sizes: batched_inputs = {} for name, value in inputs.items(): - if name in self.allowed_required_args: + if name in self.batch_params: # prompt is string if name == "prompt": len_prompt = len(value) @@ -170,7 +226,7 @@ def _test_inference_batch_consistent(self, batch_sizes=[2, 4, 13]): else: batched_inputs[name] = value - for arg in self.num_inference_steps_args: + for arg in additional_params_copy_to_batched_inputs: batched_inputs[arg] = inputs[arg] batched_inputs["output_type"] = None @@ -197,7 +253,11 @@ def test_inference_batch_single_identical(self): self._test_inference_batch_single_identical() def _test_inference_batch_single_identical( - self, test_max_difference=None, test_mean_pixel_difference=None, relax_max_difference=False + self, + test_max_difference=None, + test_mean_pixel_difference=None, + relax_max_difference=False, + additional_params_copy_to_batched_inputs=["num_inference_steps"], ): if self.pipeline_class.__name__ in [ "CycleDiffusionPipeline", @@ -234,7 +294,7 @@ def _test_inference_batch_single_identical( batched_inputs = {} batch_size = 3 for name, value in inputs.items(): - if name in self.allowed_required_args: + if name in self.batch_params: # prompt is string if name == "prompt": len_prompt = len(value) @@ -253,7 +313,7 @@ def _test_inference_batch_single_identical( else: batched_inputs[name] = value - for arg in self.num_inference_steps_args: + for arg in additional_params_copy_to_batched_inputs: batched_inputs[arg] = inputs[arg] if self.pipeline_class.__name__ != "DanceDiffusionPipeline": From 86ec20922d7c740c0e463bb1384b3b8513a3b5e2 Mon Sep 17 00:00:00 2001 From: William Berman Date: Mon, 27 Feb 2023 15:33:48 -0800 Subject: [PATCH 3/4] error message text re: @yiyixuxu --- tests/test_pipelines_common.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_pipelines_common.py b/tests/test_pipelines_common.py index c49aba5eeb18..3bd2269e5f5a 100644 --- a/tests/test_pipelines_common.py +++ b/tests/test_pipelines_common.py @@ -85,10 +85,10 @@ def get_dummy_inputs(self, device, seed=0): def params(self) -> frozenset: raise NotImplementedError( "You need to set the attribute `params` in the child test class. " - "`params` are checked if they can be passed to `__call__`. " - "`params` are used for families of pipelines that have common parameters such as text to " - "image pipelines for prompts and prompt embedding overrides. `pipeline_params.py` provides " - "some common sets of parameters such as `TEXT_TO_IMAGE_PARAMS`, `IMAGE_VARIATION_PARAMS`, etc... " + "`params` are checked for if all values are present in `__call__`'s signature." + " You can set `params` using one of the common set of parameters defined in`pipeline_params.py`" + " e.g., `TEXT_TO_IMAGE_PARAMS` defines the common parameters used in text to " + "image pipelines, including prompts and prompt embedding overrides." "If your pipeline's set of arguments has minor changes from one of the common sets of arguments, " "do not make modifications to the existing common sets of arguments. I.e. a text to image pipeline " "with non-configurable height and width arguments should set the attribute as " From 470ec3aa6e292fd363fc1528235c17d967c7c211 Mon Sep 17 00:00:00 2001 From: William Berman Date: Wed, 1 Mar 2023 12:30:15 -0800 Subject: [PATCH 4/4] remove eta re: @patrickvonplaten --- tests/pipelines/dance_diffusion/test_dance_diffusion.py | 1 - tests/pipelines/dit/test_dit.py | 1 - .../stable_diffusion_2/test_stable_diffusion_latent_upscale.py | 2 +- tests/test_pipelines_common.py | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/pipelines/dance_diffusion/test_dance_diffusion.py b/tests/pipelines/dance_diffusion/test_dance_diffusion.py index 414f6a53c5eb..bbd4aa694b76 100644 --- a/tests/pipelines/dance_diffusion/test_dance_diffusion.py +++ b/tests/pipelines/dance_diffusion/test_dance_diffusion.py @@ -38,7 +38,6 @@ class DanceDiffusionPipelineFastTests(PipelineTesterMixin, unittest.TestCase): "latents", "callback_steps", "output_type", - "eta", "num_images_per_prompt", } batch_params = UNCONDITIONAL_AUDIO_GENERATION_BATCH_PARAMS diff --git a/tests/pipelines/dit/test_dit.py b/tests/pipelines/dit/test_dit.py index ae46bf4e180c..2783dbb2e6e0 100644 --- a/tests/pipelines/dit/test_dit.py +++ b/tests/pipelines/dit/test_dit.py @@ -39,7 +39,6 @@ class DiTPipelineFastTests(PipelineTesterMixin, unittest.TestCase): required_optional_params = PipelineTesterMixin.required_optional_params - { "latents", "num_images_per_prompt", - "eta", "callback", "callback_steps", } diff --git a/tests/pipelines/stable_diffusion_2/test_stable_diffusion_latent_upscale.py b/tests/pipelines/stable_diffusion_2/test_stable_diffusion_latent_upscale.py index 2746c13e1a01..fbba80f0452a 100644 --- a/tests/pipelines/stable_diffusion_2/test_stable_diffusion_latent_upscale.py +++ b/tests/pipelines/stable_diffusion_2/test_stable_diffusion_latent_upscale.py @@ -47,7 +47,7 @@ class StableDiffusionLatentUpscalePipelineFastTests(PipelineTesterMixin, unittes "negative_prompt_embeds", "prompt_embeds", } - required_optional_params = PipelineTesterMixin.required_optional_params - {"num_images_per_prompt", "eta"} + required_optional_params = PipelineTesterMixin.required_optional_params - {"num_images_per_prompt"} batch_params = TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS test_cpu_offload = True diff --git a/tests/test_pipelines_common.py b/tests/test_pipelines_common.py index dd3143b675e1..0756340c1f3b 100644 --- a/tests/test_pipelines_common.py +++ b/tests/test_pipelines_common.py @@ -35,7 +35,6 @@ class PipelineTesterMixin: [ "num_inference_steps", "num_images_per_prompt", - "eta", "generator", "latents", "output_type",