Unverified Commit 24053832 authored by Aryan's avatar Aryan Committed by GitHub
Browse files

[tests] remove/speedup some low signal tests (#9285)

* remove 2 shapes from SDFunctionTesterMixin::test_vae_tiling

* combine freeu enable/disable test to reduce many inference runs

* remove low signal unet test for signature

* remove low signal embeddings test

* remove low signal progress bar test from PipelineTesterMixin

* combine ip-adapter single and multi tests to save many inferences

* fix broken tests

* Update tests/pipelines/test_pipelines_common.py

* Update tests/pipelines/test_pipelines_common.py

* add progress bar tests
parent f6f16a0c
...@@ -55,17 +55,6 @@ class EmbeddingsTests(unittest.TestCase): ...@@ -55,17 +55,6 @@ class EmbeddingsTests(unittest.TestCase):
assert grad > prev_grad assert grad > prev_grad
prev_grad = grad prev_grad = grad
def test_timestep_defaults(self):
embedding_dim = 16
timesteps = torch.arange(10)
t1 = get_timestep_embedding(timesteps, embedding_dim)
t2 = get_timestep_embedding(
timesteps, embedding_dim, flip_sin_to_cos=False, downscale_freq_shift=1, max_period=10_000
)
assert torch.allclose(t1.cpu(), t2.cpu(), 1e-3)
def test_timestep_flip_sin_cos(self): def test_timestep_flip_sin_cos(self):
embedding_dim = 16 embedding_dim = 16
timesteps = torch.arange(10) timesteps = torch.arange(10)
......
...@@ -183,17 +183,6 @@ class ModelUtilsTest(unittest.TestCase): ...@@ -183,17 +183,6 @@ class ModelUtilsTest(unittest.TestCase):
class UNetTesterMixin: class UNetTesterMixin:
def test_forward_signature(self):
init_dict, _ = self.prepare_init_args_and_inputs_for_common()
model = self.model_class(**init_dict)
signature = inspect.signature(model.forward)
# signature.parameters is an OrderedDict => so arg_names order is deterministic
arg_names = [*signature.parameters.keys()]
expected_arg_names = ["sample", "timestep"]
self.assertListEqual(arg_names[:2], expected_arg_names)
def test_forward_with_norm_groups(self): def test_forward_with_norm_groups(self):
init_dict, inputs_dict = self.prepare_init_args_and_inputs_for_common() init_dict, inputs_dict = self.prepare_init_args_and_inputs_for_common()
......
...@@ -175,7 +175,7 @@ class AnimateDiffPipelineFastTests( ...@@ -175,7 +175,7 @@ class AnimateDiffPipelineFastTests(
def test_attention_slicing_forward_pass(self): def test_attention_slicing_forward_pass(self):
pass pass
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array( expected_pipe_slice = np.array(
...@@ -209,7 +209,7 @@ class AnimateDiffPipelineFastTests( ...@@ -209,7 +209,7 @@ class AnimateDiffPipelineFastTests(
0.5620, 0.5620,
] ]
) )
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
def test_dict_tuple_outputs_equivalent(self): def test_dict_tuple_outputs_equivalent(self):
expected_slice = None expected_slice = None
......
...@@ -193,7 +193,7 @@ class AnimateDiffControlNetPipelineFastTests( ...@@ -193,7 +193,7 @@ class AnimateDiffControlNetPipelineFastTests(
def test_attention_slicing_forward_pass(self): def test_attention_slicing_forward_pass(self):
pass pass
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array( expected_pipe_slice = np.array(
...@@ -218,7 +218,7 @@ class AnimateDiffControlNetPipelineFastTests( ...@@ -218,7 +218,7 @@ class AnimateDiffControlNetPipelineFastTests(
0.5155, 0.5155,
] ]
) )
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
def test_dict_tuple_outputs_equivalent(self): def test_dict_tuple_outputs_equivalent(self):
expected_slice = None expected_slice = None
......
...@@ -195,7 +195,7 @@ class AnimateDiffSparseControlNetPipelineFastTests( ...@@ -195,7 +195,7 @@ class AnimateDiffSparseControlNetPipelineFastTests(
def test_attention_slicing_forward_pass(self): def test_attention_slicing_forward_pass(self):
pass pass
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array( expected_pipe_slice = np.array(
...@@ -220,7 +220,7 @@ class AnimateDiffSparseControlNetPipelineFastTests( ...@@ -220,7 +220,7 @@ class AnimateDiffSparseControlNetPipelineFastTests(
0.5155, 0.5155,
] ]
) )
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
def test_dict_tuple_outputs_equivalent(self): def test_dict_tuple_outputs_equivalent(self):
expected_slice = None expected_slice = None
......
...@@ -175,7 +175,7 @@ class AnimateDiffVideoToVideoPipelineFastTests( ...@@ -175,7 +175,7 @@ class AnimateDiffVideoToVideoPipelineFastTests(
def test_attention_slicing_forward_pass(self): def test_attention_slicing_forward_pass(self):
pass pass
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
...@@ -201,7 +201,7 @@ class AnimateDiffVideoToVideoPipelineFastTests( ...@@ -201,7 +201,7 @@ class AnimateDiffVideoToVideoPipelineFastTests(
0.5378, 0.5378,
] ]
) )
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
def test_inference_batch_single_identical( def test_inference_batch_single_identical(
self, self,
......
...@@ -220,11 +220,11 @@ class ControlNetPipelineFastTests( ...@@ -220,11 +220,11 @@ class ControlNetPipelineFastTests(
def test_attention_slicing_forward_pass(self): def test_attention_slicing_forward_pass(self):
return self._test_attention_slicing_forward_pass(expected_max_diff=2e-3) return self._test_attention_slicing_forward_pass(expected_max_diff=2e-3)
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array([0.5234, 0.3333, 0.1745, 0.7605, 0.6224, 0.4637, 0.6989, 0.7526, 0.4665]) expected_pipe_slice = np.array([0.5234, 0.3333, 0.1745, 0.7605, 0.6224, 0.4637, 0.6989, 0.7526, 0.4665])
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
@unittest.skipIf( @unittest.skipIf(
torch_device != "cuda" or not is_xformers_available(), torch_device != "cuda" or not is_xformers_available(),
...@@ -460,11 +460,11 @@ class StableDiffusionMultiControlNetPipelineFastTests( ...@@ -460,11 +460,11 @@ class StableDiffusionMultiControlNetPipelineFastTests(
def test_inference_batch_single_identical(self): def test_inference_batch_single_identical(self):
self._test_inference_batch_single_identical(expected_max_diff=2e-3) self._test_inference_batch_single_identical(expected_max_diff=2e-3)
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array([0.2422, 0.3425, 0.4048, 0.5351, 0.3503, 0.2419, 0.4645, 0.4570, 0.3804]) expected_pipe_slice = np.array([0.2422, 0.3425, 0.4048, 0.5351, 0.3503, 0.2419, 0.4645, 0.4570, 0.3804])
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
def test_save_pretrained_raise_not_implemented_exception(self): def test_save_pretrained_raise_not_implemented_exception(self):
components = self.get_dummy_components() components = self.get_dummy_components()
...@@ -679,11 +679,11 @@ class StableDiffusionMultiControlNetOneModelPipelineFastTests( ...@@ -679,11 +679,11 @@ class StableDiffusionMultiControlNetOneModelPipelineFastTests(
def test_inference_batch_single_identical(self): def test_inference_batch_single_identical(self):
self._test_inference_batch_single_identical(expected_max_diff=2e-3) self._test_inference_batch_single_identical(expected_max_diff=2e-3)
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array([0.5264, 0.3203, 0.1602, 0.8235, 0.6332, 0.4593, 0.7226, 0.7777, 0.4780]) expected_pipe_slice = np.array([0.5264, 0.3203, 0.1602, 0.8235, 0.6332, 0.4593, 0.7226, 0.7777, 0.4780])
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
def test_save_pretrained_raise_not_implemented_exception(self): def test_save_pretrained_raise_not_implemented_exception(self):
components = self.get_dummy_components() components = self.get_dummy_components()
......
...@@ -173,11 +173,11 @@ class ControlNetImg2ImgPipelineFastTests( ...@@ -173,11 +173,11 @@ class ControlNetImg2ImgPipelineFastTests(
def test_attention_slicing_forward_pass(self): def test_attention_slicing_forward_pass(self):
return self._test_attention_slicing_forward_pass(expected_max_diff=2e-3) return self._test_attention_slicing_forward_pass(expected_max_diff=2e-3)
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array([0.7096, 0.5149, 0.3571, 0.5897, 0.4715, 0.4052, 0.6098, 0.6886, 0.4213]) expected_pipe_slice = np.array([0.7096, 0.5149, 0.3571, 0.5897, 0.4715, 0.4052, 0.6098, 0.6886, 0.4213])
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
@unittest.skipIf( @unittest.skipIf(
torch_device != "cuda" or not is_xformers_available(), torch_device != "cuda" or not is_xformers_available(),
...@@ -371,11 +371,11 @@ class StableDiffusionMultiControlNetPipelineFastTests( ...@@ -371,11 +371,11 @@ class StableDiffusionMultiControlNetPipelineFastTests(
def test_inference_batch_single_identical(self): def test_inference_batch_single_identical(self):
self._test_inference_batch_single_identical(expected_max_diff=2e-3) self._test_inference_batch_single_identical(expected_max_diff=2e-3)
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array([0.5293, 0.7339, 0.6642, 0.3950, 0.5212, 0.5175, 0.7002, 0.5907, 0.5182]) expected_pipe_slice = np.array([0.5293, 0.7339, 0.6642, 0.3950, 0.5212, 0.5175, 0.7002, 0.5907, 0.5182])
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
def test_save_pretrained_raise_not_implemented_exception(self): def test_save_pretrained_raise_not_implemented_exception(self):
components = self.get_dummy_components() components = self.get_dummy_components()
......
...@@ -190,14 +190,14 @@ class StableDiffusionXLControlNetPipelineFastTests( ...@@ -190,14 +190,14 @@ class StableDiffusionXLControlNetPipelineFastTests(
def test_attention_slicing_forward_pass(self): def test_attention_slicing_forward_pass(self):
return self._test_attention_slicing_forward_pass(expected_max_diff=2e-3) return self._test_attention_slicing_forward_pass(expected_max_diff=2e-3)
def test_ip_adapter_single(self, from_ssd1b=False, expected_pipe_slice=None): def test_ip_adapter(self, from_ssd1b=False, expected_pipe_slice=None):
if not from_ssd1b: if not from_ssd1b:
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array( expected_pipe_slice = np.array(
[0.7335, 0.5866, 0.5623, 0.6242, 0.5751, 0.5999, 0.4091, 0.4590, 0.5054] [0.7335, 0.5866, 0.5623, 0.6242, 0.5751, 0.5999, 0.4091, 0.4590, 0.5054]
) )
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
@unittest.skipIf( @unittest.skipIf(
torch_device != "cuda" or not is_xformers_available(), torch_device != "cuda" or not is_xformers_available(),
...@@ -970,12 +970,12 @@ class StableDiffusionSSD1BControlNetPipelineFastTests(StableDiffusionXLControlNe ...@@ -970,12 +970,12 @@ class StableDiffusionSSD1BControlNetPipelineFastTests(StableDiffusionXLControlNe
# make sure that it's equal # make sure that it's equal
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-4 assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-4
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array([0.7212, 0.5890, 0.5491, 0.6425, 0.5970, 0.6091, 0.4418, 0.4556, 0.5032]) expected_pipe_slice = np.array([0.7212, 0.5890, 0.5491, 0.6425, 0.5970, 0.6091, 0.4418, 0.4556, 0.5032])
return super().test_ip_adapter_single(from_ssd1b=True, expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(from_ssd1b=True, expected_pipe_slice=expected_pipe_slice)
def test_controlnet_sdxl_lcm(self): def test_controlnet_sdxl_lcm(self):
device = "cpu" # ensure determinism for the device-dependent torch.Generator device = "cpu" # ensure determinism for the device-dependent torch.Generator
......
...@@ -175,12 +175,12 @@ class ControlNetPipelineSDXLImg2ImgFastTests( ...@@ -175,12 +175,12 @@ class ControlNetPipelineSDXLImg2ImgFastTests(
return inputs return inputs
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array([0.6276, 0.5271, 0.5205, 0.5393, 0.5774, 0.5872, 0.5456, 0.5415, 0.5354]) expected_pipe_slice = np.array([0.6276, 0.5271, 0.5205, 0.5393, 0.5774, 0.5872, 0.5456, 0.5415, 0.5354])
# TODO: update after slices.p # TODO: update after slices.p
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
def test_stable_diffusion_xl_controlnet_img2img(self): def test_stable_diffusion_xl_controlnet_img2img(self):
device = "cpu" # ensure determinism for the device-dependent torch.Generator device = "cpu" # ensure determinism for the device-dependent torch.Generator
......
...@@ -550,7 +550,7 @@ class IPAdapterSDXLIntegrationTests(IPAdapterNightlyTestsMixin): ...@@ -550,7 +550,7 @@ class IPAdapterSDXLIntegrationTests(IPAdapterNightlyTestsMixin):
max_diff = numpy_cosine_similarity_distance(image_slice, expected_slice) max_diff = numpy_cosine_similarity_distance(image_slice, expected_slice)
assert max_diff < 5e-4 assert max_diff < 5e-4
def test_ip_adapter_single_mask(self): def test_ip_adapter_mask(self):
image_encoder = self.get_image_encoder(repo_id="h94/IP-Adapter", subfolder="models/image_encoder") image_encoder = self.get_image_encoder(repo_id="h94/IP-Adapter", subfolder="models/image_encoder")
pipeline = StableDiffusionXLPipeline.from_pretrained( pipeline = StableDiffusionXLPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0", "stabilityai/stable-diffusion-xl-base-1.0",
......
...@@ -108,11 +108,11 @@ class LatentConsistencyModelPipelineFastTests( ...@@ -108,11 +108,11 @@ class LatentConsistencyModelPipelineFastTests(
} }
return inputs return inputs
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array([0.1403, 0.5072, 0.5316, 0.1202, 0.3865, 0.4211, 0.5363, 0.3557, 0.3645]) expected_pipe_slice = np.array([0.1403, 0.5072, 0.5316, 0.1202, 0.3865, 0.4211, 0.5363, 0.3557, 0.3645])
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
def test_lcm_onestep(self): def test_lcm_onestep(self):
device = "cpu" # ensure determinism for the device-dependent torch.Generator device = "cpu" # ensure determinism for the device-dependent torch.Generator
......
...@@ -119,11 +119,11 @@ class LatentConsistencyModelImg2ImgPipelineFastTests( ...@@ -119,11 +119,11 @@ class LatentConsistencyModelImg2ImgPipelineFastTests(
} }
return inputs return inputs
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array([0.4003, 0.3718, 0.2863, 0.5500, 0.5587, 0.3772, 0.4617, 0.4961, 0.4417]) expected_pipe_slice = np.array([0.4003, 0.3718, 0.2863, 0.5500, 0.5587, 0.3772, 0.4617, 0.4961, 0.4417])
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
def test_lcm_onestep(self): def test_lcm_onestep(self):
device = "cpu" # ensure determinism for the device-dependent torch.Generator device = "cpu" # ensure determinism for the device-dependent torch.Generator
......
...@@ -175,7 +175,7 @@ class AnimateDiffPAGPipelineFastTests( ...@@ -175,7 +175,7 @@ class AnimateDiffPAGPipelineFastTests(
def test_attention_slicing_forward_pass(self): def test_attention_slicing_forward_pass(self):
pass pass
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
...@@ -210,7 +210,7 @@ class AnimateDiffPAGPipelineFastTests( ...@@ -210,7 +210,7 @@ class AnimateDiffPAGPipelineFastTests(
0.5538, 0.5538,
] ]
) )
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
def test_dict_tuple_outputs_equivalent(self): def test_dict_tuple_outputs_equivalent(self):
expected_slice = None expected_slice = None
......
...@@ -176,7 +176,7 @@ class PIAPipelineFastTests(IPAdapterTesterMixin, PipelineTesterMixin, PipelineFr ...@@ -176,7 +176,7 @@ class PIAPipelineFastTests(IPAdapterTesterMixin, PipelineTesterMixin, PipelineFr
assert isinstance(pipe.unet, UNetMotionModel) assert isinstance(pipe.unet, UNetMotionModel)
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
...@@ -211,7 +211,7 @@ class PIAPipelineFastTests(IPAdapterTesterMixin, PipelineTesterMixin, PipelineFr ...@@ -211,7 +211,7 @@ class PIAPipelineFastTests(IPAdapterTesterMixin, PipelineTesterMixin, PipelineFr
0.5538, 0.5538,
] ]
) )
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
def test_dict_tuple_outputs_equivalent(self): def test_dict_tuple_outputs_equivalent(self):
expected_slice = None expected_slice = None
......
...@@ -253,11 +253,11 @@ class StableDiffusionImg2ImgPipelineFastTests( ...@@ -253,11 +253,11 @@ class StableDiffusionImg2ImgPipelineFastTests(
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-3 assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-3
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array([0.4932, 0.5092, 0.5135, 0.5517, 0.5626, 0.6621, 0.6490, 0.5021, 0.5441]) expected_pipe_slice = np.array([0.4932, 0.5092, 0.5135, 0.5517, 0.5626, 0.6621, 0.6490, 0.5021, 0.5441])
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
def test_stable_diffusion_img2img_multiple_init_images(self): def test_stable_diffusion_img2img_multiple_init_images(self):
device = "cpu" # ensure determinism for the device-dependent torch.Generator device = "cpu" # ensure determinism for the device-dependent torch.Generator
......
...@@ -385,14 +385,14 @@ class StableDiffusionInpaintPipelineFastTests( ...@@ -385,14 +385,14 @@ class StableDiffusionInpaintPipelineFastTests(
# they should be the same # they should be the same
assert torch.allclose(intermediate_latent, output_interrupted, atol=1e-4) assert torch.allclose(intermediate_latent, output_interrupted, atol=1e-4)
def test_ip_adapter_single(self, from_simple=False, expected_pipe_slice=None): def test_ip_adapter(self, from_simple=False, expected_pipe_slice=None):
if not from_simple: if not from_simple:
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array( expected_pipe_slice = np.array(
[0.4390, 0.5452, 0.3772, 0.5448, 0.6031, 0.4480, 0.5194, 0.4687, 0.4640] [0.4390, 0.5452, 0.3772, 0.5448, 0.6031, 0.4480, 0.5194, 0.4687, 0.4640]
) )
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
class StableDiffusionSimpleInpaintPipelineFastTests(StableDiffusionInpaintPipelineFastTests): class StableDiffusionSimpleInpaintPipelineFastTests(StableDiffusionInpaintPipelineFastTests):
...@@ -481,11 +481,11 @@ class StableDiffusionSimpleInpaintPipelineFastTests(StableDiffusionInpaintPipeli ...@@ -481,11 +481,11 @@ class StableDiffusionSimpleInpaintPipelineFastTests(StableDiffusionInpaintPipeli
} }
return inputs return inputs
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array([0.6345, 0.5395, 0.5611, 0.5403, 0.5830, 0.5855, 0.5193, 0.5443, 0.5211]) expected_pipe_slice = np.array([0.6345, 0.5395, 0.5611, 0.5403, 0.5830, 0.5855, 0.5193, 0.5443, 0.5211])
return super().test_ip_adapter_single(from_simple=True, expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(from_simple=True, expected_pipe_slice=expected_pipe_slice)
def test_stable_diffusion_inpaint(self): def test_stable_diffusion_inpaint(self):
device = "cpu" # ensure determinism for the device-dependent torch.Generator device = "cpu" # ensure determinism for the device-dependent torch.Generator
......
...@@ -281,9 +281,6 @@ class StableDiffusionDepth2ImgPipelineFastTests( ...@@ -281,9 +281,6 @@ class StableDiffusionDepth2ImgPipelineFastTests(
max_diff = np.abs(output - output_tuple).max() max_diff = np.abs(output - output_tuple).max()
self.assertLess(max_diff, 1e-4) self.assertLess(max_diff, 1e-4)
def test_progress_bar(self):
super().test_progress_bar()
def test_stable_diffusion_depth2img_default_case(self): def test_stable_diffusion_depth2img_default_case(self):
device = "cpu" # ensure determinism for the device-dependent torch.Generator device = "cpu" # ensure determinism for the device-dependent torch.Generator
components = self.get_dummy_components() components = self.get_dummy_components()
......
...@@ -330,12 +330,12 @@ class StableDiffusionXLPipelineFastTests( ...@@ -330,12 +330,12 @@ class StableDiffusionXLPipelineFastTests(
# make sure that it's equal # make sure that it's equal
assert np.abs(image_slice_1.flatten() - image_slice_2.flatten()).max() < 1e-4 assert np.abs(image_slice_1.flatten() - image_slice_2.flatten()).max() < 1e-4
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array([0.5388, 0.5452, 0.4694, 0.4583, 0.5253, 0.4832, 0.5288, 0.5035, 0.4766]) expected_pipe_slice = np.array([0.5388, 0.5452, 0.4694, 0.4583, 0.5253, 0.4832, 0.5288, 0.5035, 0.4766])
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
def test_attention_slicing_forward_pass(self): def test_attention_slicing_forward_pass(self):
super().test_attention_slicing_forward_pass(expected_max_diff=3e-3) super().test_attention_slicing_forward_pass(expected_max_diff=3e-3)
......
...@@ -290,7 +290,7 @@ class StableDiffusionXLAdapterPipelineFastTests( ...@@ -290,7 +290,7 @@ class StableDiffusionXLAdapterPipelineFastTests(
} }
return inputs return inputs
def test_ip_adapter_single(self, from_multi=False, expected_pipe_slice=None): def test_ip_adapter(self, from_multi=False, expected_pipe_slice=None):
if not from_multi: if not from_multi:
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
...@@ -298,7 +298,7 @@ class StableDiffusionXLAdapterPipelineFastTests( ...@@ -298,7 +298,7 @@ class StableDiffusionXLAdapterPipelineFastTests(
[0.5752, 0.6155, 0.4826, 0.5111, 0.5741, 0.4678, 0.5199, 0.5231, 0.4794] [0.5752, 0.6155, 0.4826, 0.5111, 0.5741, 0.4678, 0.5199, 0.5231, 0.4794]
) )
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(expected_pipe_slice=expected_pipe_slice)
def test_stable_diffusion_adapter_default_case(self): def test_stable_diffusion_adapter_default_case(self):
device = "cpu" # ensure determinism for the device-dependent torch.Generator device = "cpu" # ensure determinism for the device-dependent torch.Generator
...@@ -448,12 +448,12 @@ class StableDiffusionXLMultiAdapterPipelineFastTests( ...@@ -448,12 +448,12 @@ class StableDiffusionXLMultiAdapterPipelineFastTests(
expected_slice = np.array([0.5617, 0.6081, 0.4807, 0.5071, 0.5665, 0.4614, 0.5165, 0.5164, 0.4786]) expected_slice = np.array([0.5617, 0.6081, 0.4807, 0.5071, 0.5665, 0.4614, 0.5165, 0.5164, 0.4786])
assert np.abs(image_slice.flatten() - expected_slice).max() < 5e-3 assert np.abs(image_slice.flatten() - expected_slice).max() < 5e-3
def test_ip_adapter_single(self): def test_ip_adapter(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array([0.5617, 0.6081, 0.4807, 0.5071, 0.5665, 0.4614, 0.5165, 0.5164, 0.4786]) expected_pipe_slice = np.array([0.5617, 0.6081, 0.4807, 0.5071, 0.5665, 0.4614, 0.5165, 0.5164, 0.4786])
return super().test_ip_adapter_single(from_multi=True, expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter(from_multi=True, expected_pipe_slice=expected_pipe_slice)
def test_inference_batch_consistent( def test_inference_batch_consistent(
self, batch_sizes=[2, 4, 13], additional_params_copy_to_batched_inputs=["num_inference_steps"] self, batch_sizes=[2, 4, 13], additional_params_copy_to_batched_inputs=["num_inference_steps"]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment