Skip to content

Commit

Permalink
Adds tolerance to array comparison
Browse files Browse the repository at this point in the history
Signed-off-by: Flavia Beo <[email protected]>
  • Loading branch information
flaviabeo committed Jul 17, 2024
1 parent 0cf2c94 commit 8a99490
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/modules/text_embedding/test_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down

0 comments on commit 8a99490

Please sign in to comment.