Skip to content

Commit 03b28d7

Browse files
committed
enable deterministic in bnb 4 bit tests
Signed-off-by: jiqing-feng <[email protected]>
1 parent 05e8677 commit 03b28d7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/quantization/bnb/test_4bit.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ class Base4bitTests(unittest.TestCase):
9696
num_inference_steps = 10
9797
seed = 0
9898

99+
@classmethod
100+
def setUpClass(cls):
101+
torch.use_deterministic_algorithms(True)
102+
99103
def get_dummy_inputs(self):
100104
prompt_embeds = load_pt(
101105
"https://huggingface.co/datasets/hf-internal-testing/bnb-diffusers-testing-artifacts/resolve/main/prompt_embeds.pt",
@@ -480,7 +484,6 @@ def test_generate_quality_dequantize(self):
480484
r"""
481485
Test that loading the model and unquantize it produce correct results.
482486
"""
483-
torch.use_deterministic_algorithms(True)
484487
self.pipeline_4bit.transformer.dequantize()
485488
output = self.pipeline_4bit(
486489
prompt=self.prompt,

0 commit comments

Comments
 (0)