Skip to content

[UniDiffuser Tests] Fix some tests #3609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions tests/pipelines/unidiffuser/test_unidiffuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,9 @@ def test_unidiffuser_img2text_multiple_prompts_with_latents(self):

assert len(text) == 3

def test_inference_batch_single_identical(self):
super().test_inference_batch_single_identical(expected_max_diff=2e-4)

@require_torch_gpu
def test_unidiffuser_default_joint_v1_cuda_fp16(self):
device = "cuda"
Expand Down Expand Up @@ -583,7 +586,7 @@ def test_unidiffuser_default_joint_v1(self):
expected_img_slice = np.array([0.2402, 0.2375, 0.2285, 0.2378, 0.2407, 0.2263, 0.2354, 0.2307, 0.2520])
assert np.abs(image_slice.flatten() - expected_img_slice).max() < 1e-1

expected_text_prefix = "A living room"
expected_text_prefix = "a living room"
assert text[0][: len(expected_text_prefix)] == expected_text_prefix

def test_unidiffuser_default_text2img_v1(self):
Expand Down Expand Up @@ -634,9 +637,9 @@ def test_unidiffuser_default_joint_v1_fp16(self):

image_slice = image[0, -3:, -3:, -1]
expected_img_slice = np.array([0.2402, 0.2375, 0.2285, 0.2378, 0.2407, 0.2263, 0.2354, 0.2307, 0.2520])
assert np.abs(image_slice.flatten() - expected_img_slice).max() < 1e-1
assert np.abs(image_slice.flatten() - expected_img_slice).max() < 2e-1

expected_text_prefix = "A living room"
expected_text_prefix = "a living room"
assert text[0][: len(expected_text_prefix)] == expected_text_prefix

def test_unidiffuser_default_text2img_v1_fp16(self):
Expand Down