diff --git a/.github/workflows/pr_tests.yml b/.github/workflows/pr_tests.yml index 3d5fd84ad949..d06b576fa631 100644 --- a/.github/workflows/pr_tests.yml +++ b/.github/workflows/pr_tests.yml @@ -21,22 +21,27 @@ jobs: fail-fast: false matrix: config: - - name: Fast PyTorch CPU tests on Ubuntu - framework: pytorch + - name: Fast PyTorch Pipeline CPU tests + framework: pytorch_pipelines runner: docker-cpu image: diffusers/diffusers-pytorch-cpu - report: torch_cpu - - name: Fast Flax CPU tests on Ubuntu + report: torch_cpu_pipelines + - name: Fast PyTorch Models & Schedulers CPU tests + framework: pytorch_models + runner: docker-cpu + image: diffusers/diffusers-pytorch-cpu + report: torch_cpu_models_schedulers + - name: Fast Flax CPU tests framework: flax runner: docker-cpu image: diffusers/diffusers-flax-cpu report: flax_cpu - - name: Fast ONNXRuntime CPU tests on Ubuntu + - name: Fast ONNXRuntime CPU tests framework: onnxruntime runner: docker-cpu image: diffusers/diffusers-onnxruntime-cpu report: onnx_cpu - - name: PyTorch Example CPU tests on Ubuntu + - name: PyTorch Example CPU tests framework: pytorch_examples runner: docker-cpu image: diffusers/diffusers-pytorch-cpu @@ -71,13 +76,21 @@ jobs: run: | python utils/print_env.py - - name: Run fast PyTorch CPU tests - if: ${{ matrix.config.framework == 'pytorch' }} + - name: Run fast PyTorch Pipeline CPU tests + if: ${{ matrix.config.framework == 'pytorch_pipelines' }} run: | python -m pytest -n 2 --max-worker-restart=0 --dist=loadfile \ -s -v -k "not Flax and not Onnx" \ --make-reports=tests_${{ matrix.config.report }} \ - tests/ + tests/pipelines + + - name: Run fast PyTorch Model Scheduler CPU tests + if: ${{ matrix.config.framework == 'pytorch_models' }} + run: | + python -m pytest -n 2 --max-worker-restart=0 --dist=loadfile \ + -s -v -k "not Flax and not Onnx" \ + --make-reports=tests_${{ matrix.config.report }} \ + tests/models tests/schedulers tests/others - name: Run fast Flax TPU tests if: ${{ matrix.config.framework == 'flax' }} @@ -85,7 +98,7 @@ jobs: python -m pytest -n 2 --max-worker-restart=0 --dist=loadfile \ -s -v -k "Flax" \ --make-reports=tests_${{ matrix.config.report }} \ - tests/ + tests - name: Run fast ONNXRuntime CPU tests if: ${{ matrix.config.framework == 'onnxruntime' }} diff --git a/tests/test_layers_utils.py b/tests/models/test_layers_utils.py similarity index 100% rename from tests/test_layers_utils.py rename to tests/models/test_layers_utils.py diff --git a/tests/test_lora_layers.py b/tests/models/test_lora_layers.py similarity index 100% rename from tests/test_lora_layers.py rename to tests/models/test_lora_layers.py diff --git a/tests/test_modeling_common.py b/tests/models/test_modeling_common.py similarity index 100% rename from tests/test_modeling_common.py rename to tests/models/test_modeling_common.py diff --git a/tests/test_modeling_common_flax.py b/tests/models/test_modeling_common_flax.py similarity index 100% rename from tests/test_modeling_common_flax.py rename to tests/models/test_modeling_common_flax.py diff --git a/tests/models/test_models_unet_1d.py b/tests/models/test_models_unet_1d.py index d3a3d5cfc9a0..f954d876fa76 100644 --- a/tests/models/test_models_unet_1d.py +++ b/tests/models/test_models_unet_1d.py @@ -20,7 +20,7 @@ from diffusers import UNet1DModel from diffusers.utils import floats_tensor, slow, torch_device -from ..test_modeling_common import ModelTesterMixin +from .test_modeling_common import ModelTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/models/test_models_unet_2d.py b/tests/models/test_models_unet_2d.py index 8f831fcf7cbf..c20b0ef7d0a4 100644 --- a/tests/models/test_models_unet_2d.py +++ b/tests/models/test_models_unet_2d.py @@ -22,7 +22,7 @@ from diffusers import UNet2DModel from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device -from ..test_modeling_common import ModelTesterMixin +from .test_modeling_common import ModelTesterMixin logger = logging.get_logger(__name__) diff --git a/tests/models/test_models_unet_2d_condition.py b/tests/models/test_models_unet_2d_condition.py index 17e08e0a426e..15f77fb8c106 100644 --- a/tests/models/test_models_unet_2d_condition.py +++ b/tests/models/test_models_unet_2d_condition.py @@ -34,7 +34,7 @@ ) from diffusers.utils.import_utils import is_xformers_available -from ..test_modeling_common import ModelTesterMixin +from .test_modeling_common import ModelTesterMixin logger = logging.get_logger(__name__) diff --git a/tests/models/test_models_unet_3d_condition.py b/tests/models/test_models_unet_3d_condition.py index c552b503af05..f245045bb3bb 100644 --- a/tests/models/test_models_unet_3d_condition.py +++ b/tests/models/test_models_unet_3d_condition.py @@ -30,7 +30,7 @@ ) from diffusers.utils.import_utils import is_xformers_available -from ..test_modeling_common import ModelTesterMixin +from .test_modeling_common import ModelTesterMixin logger = logging.get_logger(__name__) diff --git a/tests/models/test_models_vae.py b/tests/models/test_models_vae.py index abd4a078e692..fe0041850bb4 100644 --- a/tests/models/test_models_vae.py +++ b/tests/models/test_models_vae.py @@ -22,7 +22,7 @@ from diffusers import AutoencoderKL from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device -from ..test_modeling_common import ModelTesterMixin +from .test_modeling_common import ModelTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/models/test_models_vae_flax.py b/tests/models/test_models_vae_flax.py index 8fedb85eccfc..e5c56b61a5a4 100644 --- a/tests/models/test_models_vae_flax.py +++ b/tests/models/test_models_vae_flax.py @@ -4,7 +4,7 @@ from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax -from ..test_modeling_common_flax import FlaxModelTesterMixin +from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): diff --git a/tests/models/test_models_vq.py b/tests/models/test_models_vq.py index 66c33e07371e..015d2abfc6fa 100644 --- a/tests/models/test_models_vq.py +++ b/tests/models/test_models_vq.py @@ -20,7 +20,7 @@ from diffusers import VQModel from diffusers.utils import floats_tensor, torch_device -from ..test_modeling_common import ModelTesterMixin +from .test_modeling_common import ModelTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/test_unet_2d_blocks.py b/tests/models/test_unet_2d_blocks.py similarity index 100% rename from tests/test_unet_2d_blocks.py rename to tests/models/test_unet_2d_blocks.py diff --git a/tests/test_unet_blocks_common.py b/tests/models/test_unet_blocks_common.py similarity index 100% rename from tests/test_unet_blocks_common.py rename to tests/models/test_unet_blocks_common.py diff --git a/tests/repo_utils/test_check_copies.py b/tests/others/test_check_copies.py similarity index 100% rename from tests/repo_utils/test_check_copies.py rename to tests/others/test_check_copies.py diff --git a/tests/repo_utils/test_check_dummies.py b/tests/others/test_check_dummies.py similarity index 100% rename from tests/repo_utils/test_check_dummies.py rename to tests/others/test_check_dummies.py diff --git a/tests/test_config.py b/tests/others/test_config.py similarity index 95% rename from tests/test_config.py rename to tests/others/test_config.py index 95b0cdf9a597..a29190c199ca 100644 --- a/tests/test_config.py +++ b/tests/others/test_config.py @@ -141,6 +141,8 @@ def test_save_load(self): def test_load_ddim_from_pndm(self): logger = logging.get_logger("diffusers.configuration_utils") + # 30 for warning + logger.setLevel(30) with CaptureLogger(logger) as cap_logger: ddim = DDIMScheduler.from_pretrained( @@ -153,6 +155,8 @@ def test_load_ddim_from_pndm(self): def test_load_euler_from_pndm(self): logger = logging.get_logger("diffusers.configuration_utils") + # 30 for warning + logger.setLevel(30) with CaptureLogger(logger) as cap_logger: euler = EulerDiscreteScheduler.from_pretrained( @@ -165,6 +169,8 @@ def test_load_euler_from_pndm(self): def test_load_euler_ancestral_from_pndm(self): logger = logging.get_logger("diffusers.configuration_utils") + # 30 for warning + logger.setLevel(30) with CaptureLogger(logger) as cap_logger: euler = EulerAncestralDiscreteScheduler.from_pretrained( @@ -177,6 +183,8 @@ def test_load_euler_ancestral_from_pndm(self): def test_load_pndm(self): logger = logging.get_logger("diffusers.configuration_utils") + # 30 for warning + logger.setLevel(30) with CaptureLogger(logger) as cap_logger: pndm = PNDMScheduler.from_pretrained( @@ -189,6 +197,8 @@ def test_load_pndm(self): def test_overwrite_config_on_load(self): logger = logging.get_logger("diffusers.configuration_utils") + # 30 for warning + logger.setLevel(30) with CaptureLogger(logger) as cap_logger: ddpm = DDPMScheduler.from_pretrained( @@ -212,6 +222,8 @@ def test_overwrite_config_on_load(self): def test_load_dpmsolver(self): logger = logging.get_logger("diffusers.configuration_utils") + # 30 for warning + logger.setLevel(30) with CaptureLogger(logger) as cap_logger: dpm = DPMSolverMultistepScheduler.from_pretrained( diff --git a/tests/test_ema.py b/tests/others/test_ema.py similarity index 100% rename from tests/test_ema.py rename to tests/others/test_ema.py diff --git a/tests/test_hub_utils.py b/tests/others/test_hub_utils.py similarity index 100% rename from tests/test_hub_utils.py rename to tests/others/test_hub_utils.py diff --git a/tests/test_image_processor.py b/tests/others/test_image_processor.py similarity index 100% rename from tests/test_image_processor.py rename to tests/others/test_image_processor.py diff --git a/tests/test_outputs.py b/tests/others/test_outputs.py similarity index 100% rename from tests/test_outputs.py rename to tests/others/test_outputs.py diff --git a/tests/test_training.py b/tests/others/test_training.py similarity index 100% rename from tests/test_training.py rename to tests/others/test_training.py diff --git a/tests/test_utils.py b/tests/others/test_utils.py similarity index 98% rename from tests/test_utils.py rename to tests/others/test_utils.py index 4fc4e1a06638..6e7cc095f8df 100755 --- a/tests/test_utils.py +++ b/tests/others/test_utils.py @@ -167,4 +167,4 @@ def test_deprecate_stacklevel(self): with self.assertWarns(FutureWarning) as warning: deprecate(("deprecated_arg", self.higher_version, "This message is better!!!"), standard_warn=False) assert str(warning.warning) == "This message is better!!!" - assert "diffusers/tests/test_utils.py" in warning.filename + assert "diffusers/tests/others/test_utils.py" in warning.filename diff --git a/tests/pipelines/altdiffusion/test_alt_diffusion.py b/tests/pipelines/altdiffusion/test_alt_diffusion.py index faa56e18f748..4d19621f0c2c 100644 --- a/tests/pipelines/altdiffusion/test_alt_diffusion.py +++ b/tests/pipelines/altdiffusion/test_alt_diffusion.py @@ -28,8 +28,8 @@ 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 +from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/audioldm/test_audioldm.py b/tests/pipelines/audioldm/test_audioldm.py index 10de5440eb00..ec72108fafc9 100644 --- a/tests/pipelines/audioldm/test_audioldm.py +++ b/tests/pipelines/audioldm/test_audioldm.py @@ -38,8 +38,8 @@ ) from diffusers.utils import slow, torch_device -from ...pipeline_params import TEXT_TO_AUDIO_BATCH_PARAMS, TEXT_TO_AUDIO_PARAMS -from ...test_pipelines_common import PipelineTesterMixin +from ..pipeline_params import TEXT_TO_AUDIO_BATCH_PARAMS, TEXT_TO_AUDIO_PARAMS +from ..test_pipelines_common import PipelineTesterMixin class AudioLDMPipelineFastTests(PipelineTesterMixin, unittest.TestCase): diff --git a/tests/pipelines/dance_diffusion/test_dance_diffusion.py b/tests/pipelines/dance_diffusion/test_dance_diffusion.py index bbd4aa694b76..5db90a3aa740 100644 --- a/tests/pipelines/dance_diffusion/test_dance_diffusion.py +++ b/tests/pipelines/dance_diffusion/test_dance_diffusion.py @@ -23,8 +23,8 @@ from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu, skip_mps -from ...pipeline_params import UNCONDITIONAL_AUDIO_GENERATION_BATCH_PARAMS, UNCONDITIONAL_AUDIO_GENERATION_PARAMS -from ...test_pipelines_common import PipelineTesterMixin +from ..pipeline_params import UNCONDITIONAL_AUDIO_GENERATION_BATCH_PARAMS, UNCONDITIONAL_AUDIO_GENERATION_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/ddim/test_ddim.py b/tests/pipelines/ddim/test_ddim.py index 4d2c4e490d63..319bd778e3b2 100644 --- a/tests/pipelines/ddim/test_ddim.py +++ b/tests/pipelines/ddim/test_ddim.py @@ -21,8 +21,8 @@ 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 +from ..pipeline_params import UNCONDITIONAL_IMAGE_GENERATION_BATCH_PARAMS, UNCONDITIONAL_IMAGE_GENERATION_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/dit/test_dit.py b/tests/pipelines/dit/test_dit.py index 947fd3cbf43d..d8098178f339 100644 --- a/tests/pipelines/dit/test_dit.py +++ b/tests/pipelines/dit/test_dit.py @@ -23,11 +23,11 @@ from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import require_torch_gpu -from ...pipeline_params import ( +from ..pipeline_params import ( CLASS_CONDITIONED_IMAGE_GENERATION_BATCH_PARAMS, CLASS_CONDITIONED_IMAGE_GENERATION_PARAMS, ) -from ...test_pipelines_common import PipelineTesterMixin +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/latent_diffusion/test_latent_diffusion.py b/tests/pipelines/latent_diffusion/test_latent_diffusion.py index 2ff7feda6317..05ff4162e5c6 100644 --- a/tests/pipelines/latent_diffusion/test_latent_diffusion.py +++ b/tests/pipelines/latent_diffusion/test_latent_diffusion.py @@ -23,8 +23,8 @@ 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 +from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False 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 14b045d6c480..17feba59e8e4 100644 --- a/tests/pipelines/paint_by_example/test_paint_by_example.py +++ b/tests/pipelines/paint_by_example/test_paint_by_example.py @@ -27,8 +27,8 @@ 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 +from ..pipeline_params import IMAGE_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS, IMAGE_GUIDED_IMAGE_INPAINTING_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipeline_params.py b/tests/pipelines/pipeline_params.py similarity index 100% rename from tests/pipeline_params.py rename to tests/pipelines/pipeline_params.py diff --git a/tests/pipelines/repaint/test_repaint.py b/tests/pipelines/repaint/test_repaint.py index 060e6c9161ba..4f98675bc5af 100644 --- a/tests/pipelines/repaint/test_repaint.py +++ b/tests/pipelines/repaint/test_repaint.py @@ -22,8 +22,8 @@ from diffusers import RePaintPipeline, RePaintScheduler, UNet2DModel from diffusers.utils.testing_utils import load_image, load_numpy, nightly, require_torch_gpu, skip_mps, torch_device -from ...pipeline_params import IMAGE_INPAINTING_BATCH_PARAMS, IMAGE_INPAINTING_PARAMS -from ...test_pipelines_common import PipelineTesterMixin +from ..pipeline_params import IMAGE_INPAINTING_BATCH_PARAMS, IMAGE_INPAINTING_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/spectrogram_diffusion/test_spectrogram_diffusion.py b/tests/pipelines/spectrogram_diffusion/test_spectrogram_diffusion.py index 594d7c598f75..3b64ea2d2fc1 100644 --- a/tests/pipelines/spectrogram_diffusion/test_spectrogram_diffusion.py +++ b/tests/pipelines/spectrogram_diffusion/test_spectrogram_diffusion.py @@ -24,8 +24,8 @@ from diffusers.utils import require_torch_gpu, skip_mps, slow, torch_device from diffusers.utils.testing_utils import require_note_seq, require_onnxruntime -from ...pipeline_params import TOKENS_TO_AUDIO_GENERATION_BATCH_PARAMS, TOKENS_TO_AUDIO_GENERATION_PARAMS -from ...test_pipelines_common import PipelineTesterMixin +from ..pipeline_params import TOKENS_TO_AUDIO_GENERATION_BATCH_PARAMS, TOKENS_TO_AUDIO_GENERATION_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/stable_diffusion/test_cycle_diffusion.py b/tests/pipelines/stable_diffusion/test_cycle_diffusion.py index 5282cfd8dd24..05b72ab6a0fd 100644 --- a/tests/pipelines/stable_diffusion/test_cycle_diffusion.py +++ b/tests/pipelines/stable_diffusion/test_cycle_diffusion.py @@ -25,8 +25,8 @@ from diffusers.utils import floats_tensor, load_image, 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 +from ..pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion.py b/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion.py index 3a5f9379ae50..6c90f0526662 100644 --- a/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion.py +++ b/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion.py @@ -29,7 +29,7 @@ ) from diffusers.utils.testing_utils import is_onnx_available, nightly, require_onnxruntime, require_torch_gpu -from ...test_pipelines_onnx_common import OnnxPipelineTesterMixin +from ..test_pipelines_onnx_common import OnnxPipelineTesterMixin if is_onnx_available(): diff --git a/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_img2img.py b/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_img2img.py index e1aa2f6dc0a1..9147dc461fc5 100644 --- a/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_img2img.py +++ b/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_img2img.py @@ -35,7 +35,7 @@ require_torch_gpu, ) -from ...test_pipelines_onnx_common import OnnxPipelineTesterMixin +from ..test_pipelines_onnx_common import OnnxPipelineTesterMixin if is_onnx_available(): diff --git a/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_inpaint.py b/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_inpaint.py index 16287d64d154..6004067887ea 100644 --- a/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_inpaint.py +++ b/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_inpaint.py @@ -26,7 +26,7 @@ require_torch_gpu, ) -from ...test_pipelines_onnx_common import OnnxPipelineTesterMixin +from ..test_pipelines_onnx_common import OnnxPipelineTesterMixin if is_onnx_available(): diff --git a/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_upscale.py b/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_upscale.py index d1527a42a1e5..a124c3de60ca 100644 --- a/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_upscale.py +++ b/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_upscale.py @@ -36,7 +36,7 @@ require_torch_gpu, ) -from ...test_pipelines_onnx_common import OnnxPipelineTesterMixin +from ..test_pipelines_onnx_common import OnnxPipelineTesterMixin if is_onnx_available(): diff --git a/tests/pipelines/stable_diffusion/test_stable_diffusion.py b/tests/pipelines/stable_diffusion/test_stable_diffusion.py index 79796afdf597..14421a64b9e8 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion.py @@ -40,8 +40,8 @@ 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 +from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/stable_diffusion/test_stable_diffusion_controlnet.py b/tests/pipelines/stable_diffusion/test_stable_diffusion_controlnet.py index d556e6318f43..d7c5e2b0323a 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_controlnet.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_controlnet.py @@ -33,8 +33,8 @@ from diffusers.utils.import_utils import is_xformers_available 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 +from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS +from ..test_pipelines_common import PipelineTesterMixin class StableDiffusionControlNetPipelineFastTests(PipelineTesterMixin, unittest.TestCase): 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 2a07ab64a36d..3bfa5810428a 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_image_variation.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_image_variation.py @@ -32,8 +32,8 @@ 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 +from ..pipeline_params import IMAGE_VARIATION_BATCH_PARAMS, IMAGE_VARIATION_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/stable_diffusion/test_stable_diffusion_img2img.py b/tests/pipelines/stable_diffusion/test_stable_diffusion_img2img.py index 69b92f685f25..127b1c216549 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_img2img.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_img2img.py @@ -34,8 +34,8 @@ from diffusers.utils import floats_tensor, 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 +from ..pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint.py b/tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint.py index 3553679e0ef6..290d9b0a9134 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint.py @@ -34,8 +34,8 @@ 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 +from ..pipeline_params import TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS, TEXT_GUIDED_IMAGE_INPAINTING_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False 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 78e697fbbac3..8915f524d972 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_instruction_pix2pix.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_instruction_pix2pix.py @@ -34,8 +34,8 @@ 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 +from ..pipeline_params import TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/stable_diffusion/test_stable_diffusion_model_editing.py b/tests/pipelines/stable_diffusion/test_stable_diffusion_model_editing.py index 1e11500c72b1..bafad63ec2db 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_model_editing.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_model_editing.py @@ -31,8 +31,8 @@ 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 +from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/stable_diffusion/test_stable_diffusion_panorama.py b/tests/pipelines/stable_diffusion/test_stable_diffusion_panorama.py index 752ed6e969c3..3ead4fe55bab 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_panorama.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_panorama.py @@ -32,8 +32,8 @@ 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 +from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False 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 59c45d603b91..0809a91041ce 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py @@ -33,8 +33,8 @@ from diffusers.utils import load_numpy, slow, torch_device from diffusers.utils.testing_utils import load_image, load_pt, 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 +from ..pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/stable_diffusion/test_stable_diffusion_sag.py b/tests/pipelines/stable_diffusion/test_stable_diffusion_sag.py index abaefbcad011..73859bdbf7d8 100644 --- a/tests/pipelines/stable_diffusion/test_stable_diffusion_sag.py +++ b/tests/pipelines/stable_diffusion/test_stable_diffusion_sag.py @@ -29,8 +29,8 @@ 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 +from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/stable_diffusion_2/test_stable_diffusion.py b/tests/pipelines/stable_diffusion_2/test_stable_diffusion.py index 7b607c8fdd36..623dbde99469 100644 --- a/tests/pipelines/stable_diffusion_2/test_stable_diffusion.py +++ b/tests/pipelines/stable_diffusion_2/test_stable_diffusion.py @@ -35,8 +35,8 @@ 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 +from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False 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 90bb1461d351..f153ae08cbb6 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,8 +29,8 @@ 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 +from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS +from ..test_pipelines_common import PipelineTesterMixin @skip_mps 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 6b0205f3faeb..7a5e02a42af4 100644 --- a/tests/pipelines/stable_diffusion_2/test_stable_diffusion_depth.py +++ b/tests/pipelines/stable_diffusion_2/test_stable_diffusion_depth.py @@ -51,8 +51,8 @@ ) 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 +from ..pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False 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 ee059314904f..2fa8b9045f43 100644 --- a/tests/pipelines/stable_diffusion_2/test_stable_diffusion_inpaint.py +++ b/tests/pipelines/stable_diffusion_2/test_stable_diffusion_inpaint.py @@ -26,8 +26,8 @@ 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 +from ..pipeline_params import TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS, TEXT_GUIDED_IMAGE_INPAINTING_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False 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 38f4b053714b..aff1c1cdbde9 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,8 +31,8 @@ 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 +from ..pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/stable_unclip/test_stable_unclip.py b/tests/pipelines/stable_unclip/test_stable_unclip.py index 368ab21f24a9..891323d22fe0 100644 --- a/tests/pipelines/stable_unclip/test_stable_unclip.py +++ b/tests/pipelines/stable_unclip/test_stable_unclip.py @@ -15,8 +15,8 @@ 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 +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): diff --git a/tests/pipelines/stable_unclip/test_stable_unclip_img2img.py b/tests/pipelines/stable_unclip/test_stable_unclip_img2img.py index 907853394040..69e3225ced52 100644 --- a/tests/pipelines/stable_unclip/test_stable_unclip_img2img.py +++ b/tests/pipelines/stable_unclip/test_stable_unclip_img2img.py @@ -27,8 +27,8 @@ torch_device, ) -from ...pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS -from ...test_pipelines_common import ( +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, ) diff --git a/tests/test_pipelines.py b/tests/pipelines/test_pipelines.py similarity index 100% rename from tests/test_pipelines.py rename to tests/pipelines/test_pipelines.py diff --git a/tests/test_pipelines_common.py b/tests/pipelines/test_pipelines_common.py similarity index 99% rename from tests/test_pipelines_common.py rename to tests/pipelines/test_pipelines_common.py index 981bc9061ef9..d0712bdec8f6 100644 --- a/tests/test_pipelines_common.py +++ b/tests/pipelines/test_pipelines_common.py @@ -85,7 +85,7 @@ def params(self) -> frozenset: raise NotImplementedError( "You need to set the attribute `params` in the child test class. " "`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`" + " 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, " diff --git a/tests/test_pipelines_flax.py b/tests/pipelines/test_pipelines_flax.py similarity index 100% rename from tests/test_pipelines_flax.py rename to tests/pipelines/test_pipelines_flax.py diff --git a/tests/test_pipelines_onnx_common.py b/tests/pipelines/test_pipelines_onnx_common.py similarity index 100% rename from tests/test_pipelines_onnx_common.py rename to tests/pipelines/test_pipelines_onnx_common.py diff --git a/tests/pipelines/text_to_video/test_text_to_video.py b/tests/pipelines/text_to_video/test_text_to_video.py index 438e685a443c..b59653694616 100644 --- a/tests/pipelines/text_to_video/test_text_to_video.py +++ b/tests/pipelines/text_to_video/test_text_to_video.py @@ -28,8 +28,8 @@ ) from diffusers.utils import load_numpy, skip_mps, slow -from ...pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS -from ...test_pipelines_common import PipelineTesterMixin +from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS +from ..test_pipelines_common import PipelineTesterMixin torch.backends.cuda.matmul.allow_tf32 = False diff --git a/tests/pipelines/text_to_video/test_text_to_video_zero.py b/tests/pipelines/text_to_video/test_text_to_video_zero.py index 45bb93fbd9c6..8fc7254c52d1 100644 --- a/tests/pipelines/text_to_video/test_text_to_video_zero.py +++ b/tests/pipelines/text_to_video/test_text_to_video_zero.py @@ -20,7 +20,7 @@ from diffusers import DDIMScheduler, TextToVideoZeroPipeline from diffusers.utils import load_pt, require_torch_gpu, slow -from ...test_pipelines_common import assert_mean_pixel_difference +from ..test_pipelines_common import assert_mean_pixel_difference @slow diff --git a/tests/pipelines/unclip/test_unclip.py b/tests/pipelines/unclip/test_unclip.py index c36fb02b190f..4df3e4d3828b 100644 --- a/tests/pipelines/unclip/test_unclip.py +++ b/tests/pipelines/unclip/test_unclip.py @@ -25,8 +25,8 @@ 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 +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): diff --git a/tests/pipelines/unclip/test_unclip_image_variation.py b/tests/pipelines/unclip/test_unclip_image_variation.py index 3cacb0bcad0b..57d15559cc75 100644 --- a/tests/pipelines/unclip/test_unclip_image_variation.py +++ b/tests/pipelines/unclip/test_unclip_image_variation.py @@ -39,8 +39,8 @@ 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 +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):