[Test] Consolidate eval accuracy test mixins into eval_accuracy_kit (#21047)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import unittest
|
||||
from types import SimpleNamespace
|
||||
|
||||
import requests
|
||||
|
||||
@@ -10,7 +9,7 @@ register_cuda_ci(est_time=103, suite="stage-b-test-1-gpu-small")
|
||||
register_amd_ci(est_time=230, suite="stage-b-test-1-gpu-small-amd")
|
||||
from sglang.lang.chat_template import get_chat_template_by_model_path
|
||||
from sglang.srt.utils import kill_process_tree
|
||||
from sglang.test.run_eval import run_eval
|
||||
from sglang.test.kits.eval_accuracy_kit import MMLUMixin
|
||||
from sglang.test.test_utils import (
|
||||
DEFAULT_IMAGE_URL,
|
||||
DEFAULT_MODEL_NAME_FOR_TEST,
|
||||
@@ -23,7 +22,11 @@ from sglang.test.test_utils import (
|
||||
)
|
||||
|
||||
|
||||
class TestTorchAO(CustomTestCase):
|
||||
class TestTorchAO(CustomTestCase, MMLUMixin):
|
||||
mmlu_score_threshold = 0.60
|
||||
mmlu_num_examples = 64
|
||||
mmlu_num_threads = 32
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.model = DEFAULT_MODEL_NAME_FOR_TEST
|
||||
@@ -39,18 +42,6 @@ class TestTorchAO(CustomTestCase):
|
||||
def tearDownClass(cls):
|
||||
kill_process_tree(cls.process.pid)
|
||||
|
||||
def test_mmlu(self):
|
||||
args = SimpleNamespace(
|
||||
base_url=self.base_url,
|
||||
model=self.model,
|
||||
eval_name="mmlu",
|
||||
num_examples=64,
|
||||
num_threads=32,
|
||||
)
|
||||
|
||||
metrics = run_eval(args)
|
||||
assert metrics["score"] >= 0.60
|
||||
|
||||
def run_decode(self, max_new_tokens):
|
||||
response = requests.post(
|
||||
self.base_url + "/generate",
|
||||
|
||||
Reference in New Issue
Block a user