-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ccc53d
commit d2b4595
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import unittest | ||
from types import SimpleNamespace | ||
|
||
from sglang.srt.utils import kill_child_process | ||
from sglang.test.run_eval import run_eval | ||
from sglang.test.test_utils import ( | ||
DEFAULT_MODEL_NAME_FOR_TEST, | ||
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, | ||
DEFAULT_URL_FOR_TEST, | ||
popen_launch_server, | ||
) | ||
|
||
|
||
class TestChunkedPrefill(unittest.TestCase): | ||
def run_mmlu(self, disable_radix_cache, chunked_prefill_size=32): | ||
other_args = ["--chunked-prefill-size", str(chunked_prefill_size)] | ||
if disable_radix_cache: | ||
other_args += ["--disable-radix-cache"] | ||
other_args += ["--enable-overlap-schedule"] | ||
|
||
model = DEFAULT_MODEL_NAME_FOR_TEST | ||
base_url = DEFAULT_URL_FOR_TEST | ||
process = popen_launch_server( | ||
model, | ||
base_url, | ||
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, | ||
other_args=other_args, | ||
) | ||
|
||
args = SimpleNamespace( | ||
base_url=base_url, | ||
model=model, | ||
eval_name="mmlu", | ||
num_examples=64, | ||
num_threads=32, | ||
) | ||
|
||
try: | ||
metrics = run_eval(args) | ||
assert metrics["score"] >= 0.65 | ||
finally: | ||
kill_child_process(process.pid) | ||
|
||
def test_no_radix_attention_no_chunked_prefill(self): | ||
self.run_mmlu(disable_radix_cache=True, chunked_prefill_size=-1) | ||
|
||
def test_radix_attention_no_chunked_prefill(self): | ||
self.run_mmlu(disable_radix_cache=True, chunked_prefill_size=-1) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |