Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
6ebf3137
Unverified
Commit
6ebf3137
authored
Jul 16, 2025
by
Maximilien de Bayser
Committed by
GitHub
Jul 15, 2025
Browse files
Avoid direct comparison of floating point numbers (#21002)
Signed-off-by:
Max de Bayser
<
mbayser@br.ibm.com
>
parent
cfbcb9ed
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
7 deletions
+44
-7
tests/entrypoints/openai/test_classification.py
tests/entrypoints/openai/test_classification.py
+5
-1
tests/entrypoints/openai/test_embedding.py
tests/entrypoints/openai/test_embedding.py
+15
-2
tests/entrypoints/openai/test_pooling.py
tests/entrypoints/openai/test_pooling.py
+14
-2
tests/entrypoints/openai/test_rerank.py
tests/entrypoints/openai/test_rerank.py
+5
-1
tests/entrypoints/openai/test_score.py
tests/entrypoints/openai/test_score.py
+5
-1
No files found.
tests/entrypoints/openai/test_classification.py
View file @
6ebf3137
...
...
@@ -176,4 +176,8 @@ async def test_invocations(server: RemoteOpenAIServer):
invocation_output
=
invocation_response
.
json
()
assert
classification_output
.
keys
()
==
invocation_output
.
keys
()
assert
classification_output
[
"data"
]
==
invocation_output
[
"data"
]
for
classification_data
,
invocation_data
in
zip
(
classification_output
[
"data"
],
invocation_output
[
"data"
]):
assert
classification_data
.
keys
()
==
invocation_data
.
keys
()
assert
classification_data
[
"probs"
]
==
pytest
.
approx
(
invocation_data
[
"probs"
],
rel
=
0.01
)
tests/entrypoints/openai/test_embedding.py
View file @
6ebf3137
...
...
@@ -14,6 +14,7 @@ from vllm.transformers_utils.tokenizer import get_tokenizer
from
...models.language.pooling.embed_utils
import
(
run_embedding_correctness_test
)
from
...models.utils
import
check_embeddings_close
from
...utils
import
RemoteOpenAIServer
MODEL_NAME
=
"intfloat/multilingual-e5-small"
...
...
@@ -321,7 +322,13 @@ async def test_invocations(server: RemoteOpenAIServer,
invocation_output
=
invocation_response
.
json
()
assert
completion_output
.
keys
()
==
invocation_output
.
keys
()
assert
completion_output
[
"data"
]
==
invocation_output
[
"data"
]
for
completion_data
,
invocation_data
in
zip
(
completion_output
[
"data"
],
invocation_output
[
"data"
]):
assert
completion_data
.
keys
()
==
invocation_data
.
keys
()
check_embeddings_close
(
embeddings_0_lst
=
[
completion_data
[
"embedding"
]],
embeddings_1_lst
=
[
invocation_data
[
"embedding"
]],
name_0
=
"completion"
,
name_1
=
"invocation"
)
@
pytest
.
mark
.
asyncio
...
...
@@ -355,4 +362,10 @@ async def test_invocations_conversation(server: RemoteOpenAIServer):
invocation_output
=
invocation_response
.
json
()
assert
chat_output
.
keys
()
==
invocation_output
.
keys
()
assert
chat_output
[
"data"
]
==
invocation_output
[
"data"
]
for
chat_data
,
invocation_data
in
zip
(
chat_output
[
"data"
],
invocation_output
[
"data"
]):
assert
chat_data
.
keys
()
==
invocation_data
.
keys
()
check_embeddings_close
(
embeddings_0_lst
=
[
chat_data
[
"embedding"
]],
embeddings_1_lst
=
[
invocation_data
[
"embedding"
]],
name_0
=
"chat"
,
name_1
=
"invocation"
)
tests/entrypoints/openai/test_pooling.py
View file @
6ebf3137
...
...
@@ -281,7 +281,13 @@ async def test_invocations(server: RemoteOpenAIServer):
invocation_output
=
invocation_response
.
json
()
assert
completion_output
.
keys
()
==
invocation_output
.
keys
()
assert
completion_output
[
"data"
]
==
invocation_output
[
"data"
]
for
completion_data
,
invocation_data
in
zip
(
completion_output
[
"data"
],
invocation_output
[
"data"
]):
assert
completion_data
.
keys
()
==
invocation_data
.
keys
()
check_embeddings_close
(
embeddings_0_lst
=
completion_data
[
"data"
],
embeddings_1_lst
=
invocation_data
[
"data"
],
name_0
=
"completion"
,
name_1
=
"invocation"
)
@
pytest
.
mark
.
asyncio
...
...
@@ -314,4 +320,10 @@ async def test_invocations_conversation(server: RemoteOpenAIServer):
invocation_output
=
invocation_response
.
json
()
assert
chat_output
.
keys
()
==
invocation_output
.
keys
()
assert
chat_output
[
"data"
]
==
invocation_output
[
"data"
]
for
chat_data
,
invocation_data
in
zip
(
chat_output
[
"data"
],
invocation_output
[
"data"
]):
assert
chat_data
.
keys
()
==
invocation_data
.
keys
()
check_embeddings_close
(
embeddings_0_lst
=
chat_data
[
"data"
],
embeddings_1_lst
=
invocation_data
[
"data"
],
name_0
=
"chat"
,
name_1
=
"invocation"
)
tests/entrypoints/openai/test_rerank.py
View file @
6ebf3137
...
...
@@ -120,4 +120,8 @@ def test_invocations(server: RemoteOpenAIServer):
invocation_output
=
invocation_response
.
json
()
assert
rerank_output
.
keys
()
==
invocation_output
.
keys
()
assert
rerank_output
[
"results"
]
==
invocation_output
[
"results"
]
for
rerank_result
,
invocations_result
in
zip
(
rerank_output
[
"results"
],
invocation_output
[
"results"
]):
assert
rerank_result
.
keys
()
==
invocations_result
.
keys
()
assert
rerank_result
[
"relevance_score"
]
==
pytest
.
approx
(
invocations_result
[
"relevance_score"
],
rel
=
0.01
)
tests/entrypoints/openai/test_score.py
View file @
6ebf3137
...
...
@@ -215,4 +215,8 @@ class TestModel:
invocation_output
=
invocation_response
.
json
()
assert
score_output
.
keys
()
==
invocation_output
.
keys
()
assert
score_output
[
"data"
]
==
invocation_output
[
"data"
]
for
score_data
,
invocation_data
in
zip
(
score_output
[
"data"
],
invocation_output
[
"data"
]):
assert
score_data
.
keys
()
==
invocation_data
.
keys
()
assert
score_data
[
"score"
]
==
pytest
.
approx
(
invocation_data
[
"score"
],
rel
=
0.01
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment