[NPU] Adapt MiMo-V2.5-W8A8 (#29131)

This commit is contained in:
iridiumine
2026-07-21 09:16:48 +08:00
committed by GitHub
parent fa0ced195e
commit d6ef68881e
3 changed files with 54 additions and 0 deletions
@@ -175,6 +175,10 @@ class ModelSlimConfig(QuantizationConfig):
prefix_in_quant_config = prefix.replace(
proj_name, packed_modules_mapping_subset[proj_name][0]
)
# Verify the remapped prefix exists in quant_description.
# If not (e.g. json uses fused name as-is), fall back to original.
if prefix_in_quant_config + ".weight" not in self.quant_description:
prefix_in_quant_config = prefix
if self.is_layer_skipped(
prefix, packed_modules_mapping_subset
) or self.is_layer_skipped(prefix, self.packed_modules_mapping):
@@ -149,6 +149,7 @@ META_LLAMA_3_1_8B_INSTRUCT = os.path.join(
)
MIMO_7B_RL_WEIGHTS_PATH = os.path.join(MODEL_WEIGHTS_DIR, "XiaomiMiMo/MiMo-7B-RL")
MIMO_V2_FLASH_WEIGHTS_PATH = os.path.join(MODEL_WEIGHTS_DIR, "XiaomiMiMo/MiMo-V2-Flash")
MIMO_V2_5_W8A8_WEIGHTS_PATH = os.path.join(MODEL_WEIGHTS_DIR, "solinliu/MiMo-V2.5-W8A8")
MINICPM3_4B_WEIGHTS_PATH = os.path.join(MODEL_WEIGHTS_DIR, "OpenBMB/MiniCPM3-4B")
MISTRAL_7B_INSTRUCT_V0_2_WEIGHTS_PATH = os.path.join(
MODEL_WEIGHTS_DIR, "mistralai/Mistral-7B-Instruct-v0.2"
@@ -0,0 +1,49 @@
import unittest
from sglang.test.ascend.gsm8k_ascend_mixin import GSM8KAscendMixin
from sglang.test.ascend.test_ascend_utils import MIMO_V2_5_W8A8_WEIGHTS_PATH
from sglang.test.test_utils import CustomTestCase
class TestMiMoV25W8A8GraphWithMTP(GSM8KAscendMixin, CustomTestCase):
"""Testcase: Verify the inference accuracy of MiMo-V2.5-W8A8 on GSM8K with cuda graph and MTP (speculative decoding).
[Test Category] Model
[Test Target] XiaomiMiMo/MiMo-V2.5-W8A8
[Test Config] Prefill+Decode, cuda graph enabled, EAGLE speculative decoding, modelslim quantization
"""
model = MIMO_V2_5_W8A8_WEIGHTS_PATH
accuracy = 0.9
other_args = [
"--trust-remote-code",
"--mem-fraction-static",
"0.75",
"--attention-backend",
"ascend",
"--tp-size",
"8",
"--reasoning-parser",
"mimo",
"--speculative-algorithm",
"EAGLE",
"--speculative-num-steps",
"3",
"--speculative-eagle-topk",
"1",
"--speculative-num-draft-tokens",
"4",
"--enable-multi-layer-eagle",
"--quantization",
"modelslim",
"--speculative-draft-model-quantization",
"unquant",
"--dp-size",
"2",
"--enable-dp-attention",
"--enable-dp-lm-head",
]
if __name__ == "__main__":
unittest.main()