[Feat][NVFP4] Enable NVFP4 MoE for Qwen series models (eg. Qwen3-Next) #13761 (#13761)

Co-authored-by: Kaixi Hou <kaixih@nvidia.com>
This commit is contained in:
Sam
2025-11-26 17:53:45 -07:00
committed by GitHub
co-authored by Kaixi Hou
parent 231df4b0d4
commit 91e8dc371a
4 changed files with 77 additions and 5 deletions
@@ -0,0 +1,61 @@
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.few_shot_gsm8k import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
)
class TestFlashinferTrtllmGenMoeBackend(CustomTestCase):
@classmethod
def setUpClass(cls):
cls.model = "nvidia/Qwen3-30B-A3B-NVFP4"
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=[
"--moe-runner-backend",
"flashinfer_trtllm",
"--quantization",
"modelopt_fp4",
"--trust-remote-code",
"--disable-radix-cache",
"--max-running-requests",
"1024",
"--chunked-prefill-size",
"16384",
"--mem-fraction-static",
"0.89",
"--max-prefill-tokens",
"16384",
],
)
@classmethod
def tearDownClass(cls):
kill_process_tree(cls.process.pid)
def test_gsm8k(self):
args = SimpleNamespace(
num_shots=8,
data_path=None,
num_questions=1319,
max_new_tokens=512,
parallel=1319,
host="http://127.0.0.1",
port=int(self.base_url.split(":")[-1]),
)
metrics = run_eval(args)
print(f"{metrics=}")
self.assertGreater(metrics["accuracy"], 0.88)
if __name__ == "__main__":
unittest.main()
+1
View File
@@ -24,6 +24,7 @@ suites = {
TestFile("test_flashinfer_trtllm_gen_attn_backend.py", 300),
TestFile("test_deepseek_v3_fp4_cutlass_moe.py", 900),
TestFile("test_fp4_moe.py", 300),
TestFile("test_qwen3_fp4_trtllm_gen_moe.py", 300),
],
"nightly-8-gpu-b200": [
TestFile("test_deepseek_r1_fp8_trtllm_backend.py", 3600),