From 8a9949004df00e070eb44dd28d566e8c4b7efe72 Mon Sep 17 00:00:00 2001 From: Flavia Beo Date: Wed, 17 Jul 2024 14:15:43 -0400 Subject: [PATCH] Adds tolerance to array comparison Signed-off-by: Flavia Beo --- tests/modules/text_embedding/test_embedding.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/modules/text_embedding/test_embedding.py b/tests/modules/text_embedding/test_embedding.py index b98b58af..c9ff8ccd 100644 --- a/tests/modules/text_embedding/test_embedding.py +++ b/tests/modules/text_embedding/test_embedding.py @@ -1018,7 +1018,9 @@ def test_encoding_order(loaded_model: EmbeddingModule, truncate_input_tokens): # test order by comparing value of individual embeddings in sequence for i, e in enumerate(separate_vectors): - assert np.isclose(e, combined_vectors[i]) + assert np.allclose( + e, combined_vectors[i], rtol=1e-05, atol=1e-08 + ) # test expected failure case by reordering shifted_separate_vectors = separate_vectors[1:] + [separate_vectors[0]]