From 70db3398d196861a9acf0405440f3ffa71fd6607 Mon Sep 17 00:00:00 2001 From: McZyWu Date: Fri, 30 Jan 2026 15:19:42 +0800 Subject: [PATCH] [NPU] enhance accuracy for model kimi-vl-a3b-instruct (#17480) Co-authored-by: cy --- .../modules/deepseek_v2_attention_mla_npu.py | 4 +++ .../test_ascend_kimi_vl_a3b_instruct.py | 28 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 test/registered/ascend/vlm_models/test_ascend_kimi_vl_a3b_instruct.py diff --git a/python/sglang/srt/hardware_backend/npu/modules/deepseek_v2_attention_mla_npu.py b/python/sglang/srt/hardware_backend/npu/modules/deepseek_v2_attention_mla_npu.py index 36a03d8be..cc50cb345 100644 --- a/python/sglang/srt/hardware_backend/npu/modules/deepseek_v2_attention_mla_npu.py +++ b/python/sglang/srt/hardware_backend/npu/modules/deepseek_v2_attention_mla_npu.py @@ -103,6 +103,10 @@ def forward_mha_prepare_npu( k_pe = latent_cache[:, :, m.kv_lora_rank :] if m.rotary_emb is not None: q_pe, k_pe = m.rotary_emb(positions, q_pe, k_pe) + # this is for model kimi-vl-a3B-instruct + forward_batch.token_to_kv_pool.set_kv_buffer( + m, forward_batch.out_cache_loc, kv_a.unsqueeze(1), k_pe + ) q[..., m.qk_nope_head_dim :] = q_pe diff --git a/test/registered/ascend/vlm_models/test_ascend_kimi_vl_a3b_instruct.py b/test/registered/ascend/vlm_models/test_ascend_kimi_vl_a3b_instruct.py new file mode 100644 index 000000000..6eded6df4 --- /dev/null +++ b/test/registered/ascend/vlm_models/test_ascend_kimi_vl_a3b_instruct.py @@ -0,0 +1,28 @@ +import unittest + +from sglang.test.ascend.gsm8k_ascend_mixin import GSM8KAscendMixin +from sglang.test.ci.ci_register import register_npu_ci +from sglang.test.test_utils import CustomTestCase + +register_npu_ci(est_time=400, suite="nightly-4-npu-a3", nightly=True) + + +class TestKimiVLA3BInstruct(GSM8KAscendMixin, CustomTestCase): + model = "/root/.cache/modelscope/hub/models/Kimi/Kimi-VL-A3B-Instruct" + accuracy = 0.66 + other_args = [ + "--trust-remote-code", + "--max-running-requests", + 2048, + "--mem-fraction-static", + 0.7, + "--attention-backend", + "ascend", + "--tp-size", + "4", + "--disable-cuda-graph", + ] + + +if __name__ == "__main__": + unittest.main()