Skip to content

Commit fed282b

Browse files
committed
with gc.collect
1 parent d3e8678 commit fed282b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/pipelines/animatediff/test_animatediff.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import gc
12
import unittest
23

34
import numpy as np
@@ -19,7 +20,7 @@
1920
from diffusers.models.attention import FreeNoiseTransformerBlock
2021
from diffusers.utils import is_xformers_available, logging
2122
from diffusers.utils.testing_utils import (
22-
flush_memory,
23+
backend_empty_cache,
2324
numpy_cosine_similarity_distance,
2425
require_accelerator,
2526
require_torch_accelerator,
@@ -552,12 +553,14 @@ class AnimateDiffPipelineSlowTests(unittest.TestCase):
552553
def setUp(self):
553554
# clean up the VRAM before each test
554555
super().setUp()
555-
flush_memory(torch_device, gc_collect=True)
556+
gc.collect()
557+
backend_empty_cache(torch_device)
556558

557559
def tearDown(self):
558560
# clean up the VRAM after each test
559561
super().tearDown()
560-
flush_memory(torch_device, gc_collect=True)
562+
gc.collect()
563+
backend_empty_cache(torch_device)
561564

562565
def test_animatediff(self):
563566
adapter = MotionAdapter.from_pretrained("guoyww/animatediff-motion-adapter-v1-5-2")

0 commit comments

Comments
 (0)