Skip to content

Commit 5e049f1

Browse files
committed
use backend APIs
Signed-off-by: Yao Matrix <[email protected]>
1 parent 258e2b7 commit 5e049f1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/quantization/quanto/test_quanto.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from diffusers.models.attention_processor import Attention
77
from diffusers.utils import is_optimum_quanto_available, is_torch_available
88
from diffusers.utils.testing_utils import (
9+
backend_reset_peak_memory_stats,
10+
backend_empty_cache,
911
enable_full_determinism,
1012
nightly,
1113
numpy_cosine_similarity_distance,
@@ -41,17 +43,15 @@ class QuantoBaseTesterMixin:
4143
keep_in_fp32_module = ""
4244
modules_to_not_convert = ""
4345
_test_torch_compile = False
44-
torch_accelerator_module = None
4546

4647
def setUp(self):
47-
self.torch_accelerator_module = getattr(torch, torch_device, torch.cuda)
48-
self.torch_accelerator_module.reset_peak_memory_stats()
49-
self.torch_accelerator_module.empty_cache()
48+
backend_reset_peak_memory_stats(torch_device)
49+
backend_empty_cache(torch_device)
5050
gc.collect()
5151

5252
def tearDown(self):
53-
self.torch_accelerator_module.reset_peak_memory_stats()
54-
self.torch_accelerator_module.empty_cache()
53+
backend_reset_peak_memory_stats(torch_device)
54+
backend_empty_cache(torch_device)
5555
gc.collect()
5656

5757
def get_dummy_init_kwargs(self):

0 commit comments

Comments
 (0)