Feat/add w4a16 moe support to nemotron (#25655)

This commit is contained in:
Shaun Kotek
2026-06-02 22:42:26 -07:00
committed by GitHub
parent 512bfbb1e1
commit b8d7351a74
19 changed files with 999 additions and 61 deletions
@@ -0,0 +1,13 @@
model_name: "nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-NVFP4"
tasks:
- name: "gsm8k"
metrics:
- name: "exact_match,strict-match"
value: 0.847
- name: "exact_match,flexible-extract"
value: 0.444
limit: 1319
num_concurrent: 128
num_fewshot: 5
apply_chat_template: false
fewshot_as_multiturn: true
@@ -7,6 +7,7 @@ Run with `python3 test/manual/models/test_nvidia_nemotron_3_nano_archived.py`.
import unittest
from sglang.srt.utils import is_sm80_supported, is_sm90_supported
from sglang.test.kits.lm_eval_kit import LMEvalMixin
from sglang.test.server_fixtures.default_fixture import DefaultServerBase
@@ -43,5 +44,27 @@ class TestNvidiaNemotron3Nano30BBF16FlashInfer(LMEvalMixin, DefaultServerBase):
] + NEMOTRON_3_NANO_THINKING_ARGS
@unittest.skip("Skip, test pass locally but compiling takes too long in CI")
@unittest.skipIf(
not (is_sm80_supported() or is_sm90_supported()),
"NVFP4 Marlin fallback test requires CUDA SM8X/SM9X",
)
class TestNvidiaNemotron3Nano30BNVFP4Marlin(LMEvalMixin, DefaultServerBase):
"""Test Nemotron-3-Nano-30B NVFP4 model with the Marlin path."""
model = "nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-NVFP4"
model_config_name = "lm_eval_configs/NVIDIA-Nemotron-3-Nano-30B-A3B-NVFP4.yaml"
other_args = [
"--tp-size",
"1",
"--quantization",
"modelopt_fp4",
"--fp4-gemm-backend",
"marlin",
"--moe-runner-backend",
"marlin",
] + NEMOTRON_3_NANO_THINKING_ARGS
if __name__ == "__main__":
unittest.main()
@@ -15,6 +15,7 @@ from sglang.srt.configs.load_config import LoadConfig
from sglang.srt.configs.model_config import ModelConfig
from sglang.srt.layers.modelopt_utils import QUANT_CFG_CHOICES
from sglang.srt.layers.quantization.modelopt_quant import (
ModelOptFp4Config,
ModelOptMixedPrecisionConfig,
)
from sglang.srt.model_loader.loader import ModelOptModelLoader
@@ -646,7 +647,10 @@ class TestModelOptMixedPrecisionConfig(CustomTestCase):
)
def test_mixed_precision_uses_nvfp4_min_capability(self):
self.assertEqual(ModelOptMixedPrecisionConfig.get_min_capability(), 100)
self.assertEqual(
ModelOptMixedPrecisionConfig.get_min_capability(),
ModelOptFp4Config.get_min_capability(),
)
def test_mixed_precision_quant_layer_resolution_after_mapping(self):
quant_config = ModelOptMixedPrecisionConfig.from_config(