[Qwen3.8] Enable NVIDIA NVFP4 on DGX Spark with file-backed PLE and PDL router fix (#39126)
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: rdxa <rdxa@rdxa-int-spark-01.yvb.moe> Co-authored-by: Yangmin Li <yangminl@nvidia.com> Co-authored-by: Manrique <nanomlm@gmail.com> Co-authored-by: yhyang201 <yhyang201@gmail.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
rdxa
Yangmin Li
Manrique
yhyang201
parent
d6fabb74b4
commit
cebca698e2
@@ -22,7 +22,12 @@ from sglang.srt.configs.model_config import ModelConfig
|
||||
from sglang.srt.layers.linear import ReplicatedLinear
|
||||
from sglang.srt.layers.logits_processor import should_apply_lm_head_quant_method
|
||||
from sglang.srt.layers.modelopt_utils import QUANT_CFG_CHOICES
|
||||
from sglang.srt.layers.quantization.fp8 import Fp8Config, Fp8LinearMethod
|
||||
from sglang.srt.layers.moe.fused_moe_triton.layer import FusedMoE
|
||||
from sglang.srt.layers.quantization.fp8 import (
|
||||
Fp8Config,
|
||||
Fp8LinearMethod,
|
||||
Fp8MoEMethod,
|
||||
)
|
||||
from sglang.srt.layers.quantization.modelopt_quant import (
|
||||
ModelOptFp4Config,
|
||||
ModelOptFp4LinearMethod,
|
||||
@@ -1188,6 +1193,56 @@ class TestModelOptMixedPrecisionConfig(CustomTestCase):
|
||||
"FP8",
|
||||
)
|
||||
|
||||
def test_mixed_precision_resolves_vl_language_model_keys(self):
|
||||
# nvidia/Qwen3.8-Flash-Next-NVFP4 keys the text stack as
|
||||
# `model.language_model.*` while Qwen4-Exp modules are `model.*`.
|
||||
quant_config = ModelOptMixedPrecisionConfig.from_config(
|
||||
{
|
||||
"quant_algo": "MIXED_PRECISION",
|
||||
"quantized_layers": {
|
||||
"model.language_model.layers.3.mlp.experts": {
|
||||
"quant_algo": "NVFP4",
|
||||
"group_size": 16,
|
||||
},
|
||||
"model.language_model.layers.1.ple.ple_embedding.ngram_embedding": {
|
||||
"quant_algo": "FP8"
|
||||
},
|
||||
"mtp.layers.0.mlp.experts": {
|
||||
"quant_algo": "FP8_BLOCK_SCALES",
|
||||
"group_size": 128,
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
self.assertEqual(quant_config.exclude_modules, [])
|
||||
moe = FusedMoE.__new__(FusedMoE)
|
||||
self.assertIsInstance(
|
||||
quant_config.get_quant_method(moe, "mtp.layers.0.mlp.experts"),
|
||||
Fp8MoEMethod,
|
||||
)
|
||||
self.assertEqual(
|
||||
quant_config.get_quant_method(
|
||||
moe, "mtp.layers.0.mlp.experts"
|
||||
).quant_config.weight_block_size,
|
||||
[128, 128],
|
||||
)
|
||||
self.assertEqual(
|
||||
quant_config.resolve_quant_algo("model.layers.3.mlp.experts"), "NVFP4"
|
||||
)
|
||||
self.assertEqual(
|
||||
quant_config.resolve_quant_algo(
|
||||
"model.layers.1.ple.ple_embedding.ngram_embedding"
|
||||
),
|
||||
"FP8",
|
||||
)
|
||||
self.assertIsNone(
|
||||
quant_config.resolve_quant_algo("model.layers.1.ple.key_proj")
|
||||
)
|
||||
self.assertIsNone(
|
||||
quant_config.resolve_quant_algo("model.layers.3.mlp.shared_expert")
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user