Skip to content

Commit 7b58b1d

Browse files
committed
Check diff in test_layerwise_casting
1 parent 23caafc commit 7b58b1d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/models/test_modeling_common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,8 @@ def test_layerwise_casting(storage_dtype, compute_dtype):
14731473

14741474
# The precision test is not very important for fast tests. In most cases, the outputs will not be the same.
14751475
# We just want to make sure that the layerwise casting is working as expected.
1476-
self.assertTrue(numpy_cosine_similarity_distance(base_slice, output) < 1.0)
1476+
diff = numpy_cosine_similarity_distance(base_slice, output)
1477+
self.assertTrue(diff < 1.0, f"Expected {diff=} < 1.0.")
14771478

14781479
test_layerwise_casting(torch.float16, torch.float32)
14791480
test_layerwise_casting(torch.float8_e4m3fn, torch.float32)

0 commit comments

Comments
 (0)