Unverified Commit d8bcb33f authored by Sayak Paul's avatar Sayak Paul Committed by GitHub
Browse files

[Tests] fix slices of 26 tests (first half) (#8959)



* check for assertions.

* update with correct slices.

* okay

* style

* get it ready

* update

* update

* update

---------
Co-authored-by: default avatarDhruv Nair <dhruv.nair@gmail.com>
parent 4a782f46
...@@ -226,7 +226,8 @@ class StableDiffusionXLInpaintPipelineFastTests( ...@@ -226,7 +226,8 @@ class StableDiffusionXLInpaintPipelineFastTests(
def test_ip_adapter_single(self): def test_ip_adapter_single(self):
expected_pipe_slice = None expected_pipe_slice = None
if torch_device == "cpu": if torch_device == "cpu":
expected_pipe_slice = np.array([0.7971, 0.5371, 0.5973, 0.5642, 0.6689, 0.6894, 0.5770, 0.6063, 0.5261]) expected_pipe_slice = np.array([0.8274, 0.5538, 0.6141, 0.5843, 0.6865, 0.7082, 0.5861, 0.6123, 0.5344])
return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice) return super().test_ip_adapter_single(expected_pipe_slice=expected_pipe_slice)
def test_components_function(self): def test_components_function(self):
...@@ -250,7 +251,7 @@ class StableDiffusionXLInpaintPipelineFastTests( ...@@ -250,7 +251,7 @@ class StableDiffusionXLInpaintPipelineFastTests(
assert image.shape == (1, 64, 64, 3) assert image.shape == (1, 64, 64, 3)
expected_slice = np.array([0.8029, 0.5523, 0.5825, 0.6003, 0.6702, 0.7018, 0.6369, 0.5955, 0.5123]) expected_slice = np.array([0.8279, 0.5673, 0.6088, 0.6156, 0.6923, 0.7347, 0.6547, 0.6108, 0.5198])
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2 assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2
...@@ -385,7 +386,7 @@ class StableDiffusionXLInpaintPipelineFastTests( ...@@ -385,7 +386,7 @@ class StableDiffusionXLInpaintPipelineFastTests(
assert image.shape == (1, 64, 64, 3) assert image.shape == (1, 64, 64, 3)
expected_slice = np.array([0.7045, 0.4838, 0.5454, 0.6270, 0.6168, 0.6717, 0.6484, 0.5681, 0.4922]) expected_slice = np.array([0.7540, 0.5231, 0.5833, 0.6217, 0.6339, 0.7067, 0.6507, 0.5672, 0.5030])
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2 assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2
......
...@@ -182,7 +182,7 @@ class StableUnCLIPImg2ImgPipelineFastTests( ...@@ -182,7 +182,7 @@ class StableUnCLIPImg2ImgPipelineFastTests(
image_slice = image[0, -3:, -3:, -1] image_slice = image[0, -3:, -3:, -1]
assert image.shape == (1, 32, 32, 3) assert image.shape == (1, 32, 32, 3)
expected_slice = np.array([0.3872, 0.7224, 0.5601, 0.4741, 0.6872, 0.5814, 0.4636, 0.3867, 0.5078]) expected_slice = np.array([0.4397, 0.7080, 0.5590, 0.4255, 0.7181, 0.5938, 0.4051, 0.3720, 0.5116])
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-3 assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-3
......
...@@ -168,8 +168,12 @@ class TextToVideoZeroSDXLPipelineFastTests(PipelineTesterMixin, PipelineFromPipe ...@@ -168,8 +168,12 @@ class TextToVideoZeroSDXLPipelineFastTests(PipelineTesterMixin, PipelineFromPipe
first_frame_slice = result[0, -3:, -3:, -1] first_frame_slice = result[0, -3:, -3:, -1]
last_frame_slice = result[-1, -3:, -3:, 0] last_frame_slice = result[-1, -3:, -3:, 0]
expected_slice1 = np.array([0.48, 0.58, 0.53, 0.59, 0.50, 0.44, 0.60, 0.65, 0.52]) expected_slice1 = np.array(
expected_slice2 = np.array([0.66, 0.49, 0.40, 0.70, 0.47, 0.51, 0.73, 0.65, 0.52]) [0.6008109, 0.73051643, 0.51778656, 0.55817354, 0.45222935, 0.45998418, 0.57017255, 0.54874814, 0.47078788]
)
expected_slice2 = np.array(
[0.6011751, 0.47420046, 0.41660714, 0.6472957, 0.41261768, 0.5438129, 0.7401535, 0.6756011, 0.53652245]
)
assert np.abs(first_frame_slice.flatten() - expected_slice1).max() < 1e-2 assert np.abs(first_frame_slice.flatten() - expected_slice1).max() < 1e-2
assert np.abs(last_frame_slice.flatten() - expected_slice2).max() < 1e-2 assert np.abs(last_frame_slice.flatten() - expected_slice2).max() < 1e-2
......
...@@ -76,7 +76,7 @@ def main(correct, fail=None): ...@@ -76,7 +76,7 @@ def main(correct, fail=None):
done_tests = defaultdict(int) done_tests = defaultdict(int)
for line in correct_lines: for line in correct_lines:
file, class_name, test_name, correct_line = line.split(";") file, class_name, test_name, correct_line = line.split("::")
if test_failures is None or "::".join([file, class_name, test_name]) in test_failures: if test_failures is None or "::".join([file, class_name, test_name]) in test_failures:
overwrite_file(file, class_name, test_name, correct_line, done_tests) overwrite_file(file, class_name, test_name, correct_line, done_tests)
......
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