diff --git a/tests/pipelines/pipeline_params.py b/tests/pipelines/pipeline_params.py index 2023d02663..3db7c9fa1b 100644 --- a/tests/pipelines/pipeline_params.py +++ b/tests/pipelines/pipeline_params.py @@ -131,4 +131,4 @@ TOKENS_TO_AUDIO_GENERATION_BATCH_PARAMS = frozenset(["input_tokens"]) VIDEO_TO_VIDEO_BATCH_PARAMS = frozenset(["prompt", "negative_prompt", "video"]) # callback params -TEXT_TO_IMAGE_CALLBACK_CFG_PARAMS = frozenset(["prompt_embeds"]) \ No newline at end of file +TEXT_TO_IMAGE_CALLBACK_CFG_PARAMS = frozenset(["prompt_embeds"]) diff --git a/tests/pipelines/stable_diffusion_xl/test_stable_diffusion_xl_modular.py b/tests/pipelines/stable_diffusion_xl/test_stable_diffusion_xl_modular.py index 2027de2546..aaa780cf98 100644 --- a/tests/pipelines/stable_diffusion_xl/test_stable_diffusion_xl_modular.py +++ b/tests/pipelines/stable_diffusion_xl/test_stable_diffusion_xl_modular.py @@ -13,43 +13,28 @@ # See the License for the specific language governing permissions and # limitations under the License. -import copy -import gc import tempfile import unittest import numpy as np import torch -from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( - ModularPipeline, - ComponentSpec, ComponentsManager, - AutoencoderKL, - DDIMScheduler, - DPMSolverMultistepScheduler, - EulerDiscreteScheduler, - HeunDiscreteScheduler, LCMScheduler, - StableDiffusionXLImg2ImgPipeline, + ModularPipeline, StableDiffusionXLPipeline, - UNet2DConditionModel, - UniPCMultistepScheduler, ) from diffusers.utils.testing_utils import ( - backend_empty_cache, enable_full_determinism, - load_image, - numpy_cosine_similarity_distance, require_torch_accelerator, - slow, torch_device, ) from ..pipeline_params import ( + IMAGE_INPAINTING_BATCH_PARAMS, + IMAGE_INPAINTING_PARAMS, TEXT_TO_IMAGE_BATCH_PARAMS, - TEXT_TO_IMAGE_CALLBACK_CFG_PARAMS, TEXT_TO_IMAGE_IMAGE_PARAMS, TEXT_TO_IMAGE_PARAMS, ) @@ -143,12 +128,16 @@ class StableDiffusionXLModularPipelineFastTests( @require_torch_accelerator def test_stable_diffusion_xl_offloads(self): pipes = [] - sd_pipe = ModularPipeline.from_pretrained("hf-internal-testing/tiny-sd-pipe",).to(torch_device) + sd_pipe = ModularPipeline.from_pretrained( + "hf-internal-testing/tiny-sd-pipe", + ).to(torch_device) pipes.append(sd_pipe) cm = ComponentsManager() cm.enable_auto_cpu_offload(device=torch_device) - sd_pipe = ModularPipeline.from_pretrained("hf-internal-testing/tiny-sd-pipe", components_manager=cm).to(torch_device) + sd_pipe = ModularPipeline.from_pretrained("hf-internal-testing/tiny-sd-pipe", components_manager=cm).to( + torch_device + ) pipes.append(sd_pipe) image_slices = [] @@ -253,4 +242,4 @@ class StableDiffusionXLModularPipelineFastTests( image_slices.append(image[0, -3:, -3:, -1].flatten()) - assert np.abs(image_slices[0] - image_slices[1]).max() < 1e-3 \ No newline at end of file + assert np.abs(image_slices[0] - image_slices[1]).max() < 1e-3