Skip to content

Commit 3c6204f

Browse files
authored
[Tests] Update condition for sparsity check to be more robust (#1337)
SUMMARY: - Failing on nightly
1 parent c5dbf0c commit 3c6204f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/llmcompressor/transformers/finetune/test_oneshot_and_finetune.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
class TestOneshotAndFinetune(unittest.TestCase):
1919
def _test_oneshot_and_finetune(self):
20+
import math
21+
2022
from llmcompressor import oneshot, train
2123

2224
splits = {"train": "train[:5%]", "calibration": "train[5%:10%]"}
@@ -64,9 +66,10 @@ def _test_oneshot_and_finetune(self):
6466
).quantization_config
6567
)
6668
# model is first sparsified, then finetuned, both should have the same sparsity
67-
assert (
68-
config_sparse_applied["global_sparsity"]
69-
>= config_finetune_applied["global_sparsity"]
69+
assert math.isclose(
70+
config_sparse_applied["global_sparsity"],
71+
config_finetune_applied["global_sparsity"],
72+
abs_tol=1e-05,
7073
)
7174

7275
def tearDown(self):

0 commit comments

Comments
 (0)