1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-27 17:22:53 +03:00

reset deterministic in tearDownClass (#11785)

* reset deterministic in tearDownClass

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix deterministic setting

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

---------

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
This commit is contained in:
jiqing-feng
2025-07-01 12:36:54 +08:00
committed by GitHub
parent 87f83d3dd9
commit f3e1310469
2 changed files with 16 additions and 2 deletions

View File

@@ -98,7 +98,14 @@ class Base4bitTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
torch.use_deterministic_algorithms(True)
cls.is_deterministic_enabled = torch.are_deterministic_algorithms_enabled()
if not cls.is_deterministic_enabled:
torch.use_deterministic_algorithms(True)
@classmethod
def tearDownClass(cls):
if not cls.is_deterministic_enabled:
torch.use_deterministic_algorithms(False)
def get_dummy_inputs(self):
prompt_embeds = load_pt(

View File

@@ -99,7 +99,14 @@ class Base8bitTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
torch.use_deterministic_algorithms(True)
cls.is_deterministic_enabled = torch.are_deterministic_algorithms_enabled()
if not cls.is_deterministic_enabled:
torch.use_deterministic_algorithms(True)
@classmethod
def tearDownClass(cls):
if not cls.is_deterministic_enabled:
torch.use_deterministic_algorithms(False)
def get_dummy_inputs(self):
prompt_embeds = load_pt(