Skip to content

Commit bad2a3e

Browse files
committed
update
1 parent 3e7490e commit bad2a3e

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

tests/pipelines/animatediff/test_animatediff_video2video_controlnet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
)
2121
from diffusers.models.attention import FreeNoiseTransformerBlock
2222
from diffusers.utils import is_xformers_available, logging
23-
from diffusers.utils.testing_utils import torch_device
23+
from diffusers.utils.testing_utils import require_non_cpu, torch_device
2424

2525
from ..pipeline_params import TEXT_TO_IMAGE_PARAMS, VIDEO_TO_VIDEO_BATCH_PARAMS
2626
from ..test_pipelines_common import IPAdapterTesterMixin, PipelineFromPipeTesterMixin, PipelineTesterMixin
@@ -274,7 +274,7 @@ def test_inference_batch_single_identical(
274274
max_diff = np.abs(to_np(output_batch[0][0]) - to_np(output[0][0])).max()
275275
assert max_diff < expected_max_diff
276276

277-
@unittest.skipIf(torch_device != "cuda", reason="CUDA and CPU are required to switch devices")
277+
@require_non_cpu
278278
def test_to_device(self):
279279
components = self.get_dummy_components()
280280
pipe = self.pipeline_class(**components)

tests/pipelines/stable_diffusion_2/test_stable_diffusion_depth.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@
3636
StableDiffusionDepth2ImgPipeline,
3737
UNet2DConditionModel,
3838
)
39-
from diffusers.utils import is_accelerate_available, is_accelerate_version
4039
from diffusers.utils.testing_utils import (
4140
enable_full_determinism,
4241
floats_tensor,
4342
load_image,
4443
load_numpy,
4544
nightly,
45+
require_accelerate_version_greater,
4646
require_non_cpu,
4747
require_torch_gpu,
4848
skip_mps,
@@ -227,6 +227,7 @@ def test_save_load_float16(self):
227227
max_diff = np.abs(output - output_loaded).max()
228228
self.assertLess(max_diff, 2e-2, "The output of the fp16 pipeline changed after saving and loading.")
229229

230+
@require_non_cpu
230231
def test_float16_inference(self):
231232
components = self.get_dummy_components()
232233
pipe = self.pipeline_class(**components)
@@ -246,10 +247,8 @@ def test_float16_inference(self):
246247
max_diff = np.abs(output - output_fp16).max()
247248
self.assertLess(max_diff, 1.3e-2, "The outputs of the fp16 and fp32 pipelines are too different.")
248249

249-
@unittest.skipIf(
250-
not is_accelerate_available() or is_accelerate_version("<", "0.14.0"),
251-
reason="CPU offload is only available with `accelerate v0.14.0` or higher",
252-
)
250+
@require_non_cpu
251+
@require_accelerate_version_greater("0.14.0")
253252
def test_cpu_offload_forward_pass(self):
254253
components = self.get_dummy_components()
255254
pipe = self.pipeline_class(**components)

0 commit comments

Comments
 (0)