[RL] Fix FP8 skip matching for trailing-dot prefixes (#26287)

This commit is contained in:
Ziang Li
2026-05-26 20:30:08 +00:00
committed by GitHub
parent 47617cc4df
commit 2b1e53c98d
3 changed files with 63 additions and 0 deletions
@@ -155,6 +155,50 @@ class FlashinferTrtllmGenMoeBackendMXFP8Base:
self.assertGreater(metrics["score"], 0.93)
class FlashinferTrtllmGenMoeBackendMXFP8MixedBF16Base:
backend = None
@classmethod
def setUpClass(cls):
cls.model = "zianglih/JoyAI-LLM-Flash-MXFP8-last-6-BF16"
cls.base_url = DEFAULT_URL_FOR_TEST
cls.process = popen_launch_server(
cls.model,
cls.base_url,
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
env={**os.environ, "SGLANG_ENABLE_JIT_DEEPGEMM": "False"},
other_args=[
"--kv-cache-dtype",
"bf16",
"--fp8-gemm-backend",
"flashinfer_cutlass",
"--moe-runner-backend",
cls.backend,
"--tp-size",
"4",
"--trust-remote-code",
],
)
@classmethod
def tearDownClass(cls):
kill_process_tree(cls.process.pid)
def test_gsm8k(self):
args = SimpleNamespace(
base_url=self.base_url,
model=self.model,
eval_name="gsm8k",
api="completion",
max_tokens=512,
num_examples=200,
num_threads=128,
)
metrics = run_eval(args)
print(f"{metrics=}")
self.assertGreater(metrics["score"], 0.92)
class FlashinferTrtllmGenMoeBackendNVFP4Base:
backend = None
extra_env = {}
@@ -217,6 +261,12 @@ class TestFlashinferTrtllmGenMoeBackendMXFP8Routed(
backend = "flashinfer_trtllm_routed"
class TestFlashinferTrtllmRoutedMxfp8MixedBF16(
FlashinferTrtllmGenMoeBackendMXFP8MixedBF16Base, CustomTestCase
):
backend = "flashinfer_trtllm_routed"
class TestFlashinferTrtllmGenMoeBackendBF16Routed(
FlashinferTrtllmGenMoeBackendBF16Base, CustomTestCase
):
@@ -47,6 +47,17 @@ class TestIsLayerSkipped(CustomTestCase):
)
self.assertTrue(is_layer_skipped("model.layers.0.mlp.gate", ignored, {}))
def test_trailing_dot_prefix_matches_child_modules(self):
# Mixed-precision checkpoints may use a trailing-dot layer prefix to keep
# every module under the layer in higher precision.
ignored = ["model.layers.34."]
self.assertTrue(
is_layer_skipped("model.layers.34.mlp.experts.0.down_proj", ignored, {})
)
self.assertFalse(
is_layer_skipped("model.layers.340.mlp.experts.0.down_proj", ignored, {})
)
if __name__ == "__main__":
unittest.main()