[CI/Build] Replace math.isclose with pytest.approx (#18703)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import math
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
@@ -92,7 +90,7 @@ class TestModel:
|
||||
hf_outputs = run_transformers(runner, model, text_pairs)
|
||||
|
||||
for i in range(len(vllm_outputs)):
|
||||
assert math.isclose(hf_outputs[i], vllm_outputs[i], rel_tol=0.01)
|
||||
assert hf_outputs[i] == pytest.approx(vllm_outputs[i], rel=0.01)
|
||||
|
||||
def test_text_1_list_text_2_list(self, server: RemoteOpenAIServer,
|
||||
model: dict[str, Any], runner):
|
||||
@@ -124,7 +122,7 @@ class TestModel:
|
||||
hf_outputs = run_transformers(runner, model, text_pairs)
|
||||
|
||||
for i in range(len(vllm_outputs)):
|
||||
assert math.isclose(hf_outputs[i], vllm_outputs[i], rel_tol=0.01)
|
||||
assert hf_outputs[i] == pytest.approx(vllm_outputs[i], rel=0.01)
|
||||
|
||||
def test_text_1_str_text_2_str(self, server: RemoteOpenAIServer,
|
||||
model: dict[str, Any], runner):
|
||||
@@ -150,7 +148,7 @@ class TestModel:
|
||||
hf_outputs = run_transformers(runner, model, text_pairs)
|
||||
|
||||
for i in range(len(vllm_outputs)):
|
||||
assert math.isclose(hf_outputs[i], vllm_outputs[i], rel_tol=0.01)
|
||||
assert hf_outputs[i] == pytest.approx(vllm_outputs[i], rel=0.01)
|
||||
|
||||
def test_score_max_model_len(self, server: RemoteOpenAIServer,
|
||||
model: dict[str, Any]):
|
||||
|
||||
Reference in New Issue
Block a user