Skip to content

Relax DiT test #2808

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 4 commits into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
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
13 changes: 10 additions & 3 deletions tests/pipelines/dit/test_dit.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import torch

from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, Transformer2DModel
from diffusers.utils import load_numpy, slow
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 (
Expand Down Expand Up @@ -97,7 +97,14 @@ def test_inference(self):
self.assertLessEqual(max_diff, 1e-3)

def test_inference_batch_single_identical(self):
self._test_inference_batch_single_identical(relax_max_difference=True)
self._test_inference_batch_single_identical(relax_max_difference=True, expected_max_diff=1e-3)

@unittest.skipIf(
torch_device != "cuda" or not is_xformers_available(),
reason="XFormers attention is only available with CUDA and `xformers` installed",
)
def test_xformers_attention_forwardGenerator_pass(self):
self._test_xformers_attention_forwardGenerator_pass(expected_max_diff=1e-3)


@require_torch_gpu
Expand All @@ -123,7 +130,7 @@ def test_dit_256(self):
expected_image = load_numpy(
f"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/dit/{word}.npy"
)
assert np.abs((expected_image - image).max()) < 1e-3
assert np.abs((expected_image - image).max()) < 1e-2

def test_dit_512(self):
pipe = DiTPipeline.from_pretrained("facebook/DiT-XL-2-512")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ def test_inference_batch_single_identical(self):
def test_inference_batch_consistent(self):
pass

@skip_mps
def test_progress_bar(self):
return super().test_progress_bar()


@slow
@require_torch_gpu
Expand Down