[Spec V2] Support specV2 for mamba hybrid attention (#18808)
Co-authored-by: Yi Zhong <207368749+vincentzed@users.noreply.github.com> Co-authored-by: yizhang2077 <1109276519@qq.com> Co-authored-by: Hanming Lu <hanming@x.ai>
This commit is contained in:
@@ -3,6 +3,7 @@ from types import SimpleNamespace
|
||||
|
||||
import requests
|
||||
|
||||
from sglang.srt.environ import envs
|
||||
from sglang.srt.utils import kill_process_tree
|
||||
from sglang.test.ci.ci_register import register_cuda_ci
|
||||
from sglang.test.few_shot_gsm8k import run_eval
|
||||
@@ -211,5 +212,88 @@ class TestQwen3NextMTPTopk(CustomTestCase):
|
||||
print("test_prefix_cache_branching passed")
|
||||
|
||||
|
||||
class TestQwen3NextMTPV2(CustomTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.model = QWEN3_NEXT_MODEL
|
||||
envs.SGLANG_ENABLE_SPEC_V2.set(True)
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
cls.process = popen_launch_server(
|
||||
cls.model,
|
||||
cls.base_url,
|
||||
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||
other_args=[
|
||||
"--trust-remote-code",
|
||||
"--speculative-algorithm",
|
||||
"NEXTN",
|
||||
"--speculative-num-steps",
|
||||
"3",
|
||||
"--speculative-eagle-topk",
|
||||
"1",
|
||||
"--speculative-num-draft-tokens",
|
||||
"4",
|
||||
"--mem-fraction-static",
|
||||
"0.8",
|
||||
"--tp",
|
||||
"4",
|
||||
"--chunked-prefill-size",
|
||||
"2048",
|
||||
"--mamba-scheduler-strategy",
|
||||
"extra_buffer",
|
||||
"--mamba-track-interval",
|
||||
"128",
|
||||
],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
envs.SGLANG_ENABLE_SPEC_V2.set(False)
|
||||
kill_process_tree(cls.process.pid)
|
||||
|
||||
def test_gsm8k(self):
|
||||
args = SimpleNamespace(
|
||||
num_shots=5,
|
||||
data_path=None,
|
||||
num_questions=200,
|
||||
max_new_tokens=512,
|
||||
parallel=128,
|
||||
host="http://127.0.0.1",
|
||||
port=int(self.base_url.split(":")[-1]),
|
||||
)
|
||||
metrics = run_eval(args)
|
||||
print(f"{metrics=}")
|
||||
self.assertGreaterEqual(
|
||||
metrics["accuracy"], ACC_THRESHOLDS[self.model]["gsm8k"]
|
||||
)
|
||||
|
||||
# TODO(hzh): After merging the PR that fixes specv2 to correctly return log probs, re-open the tests below. https://github.com/sgl-project/sglang/pull/18645
|
||||
# def test_input_output_logprobs_match(self):
|
||||
# test_input_output_logprobs_match_helper(
|
||||
# self.base_url,
|
||||
# ACC_THRESHOLDS,
|
||||
# self.model,
|
||||
# max_samples=32,
|
||||
# max_new_tokens=512,
|
||||
# )
|
||||
|
||||
# def test_input_output_logprobs_match_prefill_cache_hit(self):
|
||||
# test_input_output_logprobs_match_prefill_cache_hit_helper(
|
||||
# self.base_url,
|
||||
# ACC_THRESHOLDS,
|
||||
# self.model,
|
||||
# max_samples=32,
|
||||
# max_new_tokens=512,
|
||||
# )
|
||||
|
||||
# def test_input_output_logprobs_match_decode_cache_hit(self):
|
||||
# test_input_output_logprobs_match_decode_cache_hit_helper(
|
||||
# self.base_url,
|
||||
# ACC_THRESHOLDS,
|
||||
# self.model,
|
||||
# max_samples=32,
|
||||
# max_new_tokens=512,
|
||||
# )
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user