From 56f0affa53a7f8c31cbfe09467258d7b627e5052 Mon Sep 17 00:00:00 2001 From: baishihao Date: Mon, 13 Jan 2025 17:12:33 +0800 Subject: [PATCH] fix no quant --- .../common/fused_moe/grouped_fused_moe.py | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lightllm/common/fused_moe/grouped_fused_moe.py b/lightllm/common/fused_moe/grouped_fused_moe.py index f3d04ef59..969016215 100644 --- a/lightllm/common/fused_moe/grouped_fused_moe.py +++ b/lightllm/common/fused_moe/grouped_fused_moe.py @@ -434,9 +434,15 @@ def grouped_matmul( topk_num, token_input_scale, expert_to_weights_scale, - expert_to_weights_scale.stride(0), - expert_to_weights_scale.stride(1), - expert_to_weights_scale.stride(2), + expert_to_weights_scale.stride(0) + if expert_to_weights_scale is not None and expert_to_weights_scale.ndim == 2 + else 0, + expert_to_weights_scale.stride(1) + if expert_to_weights_scale is not None and expert_to_weights_scale.ndim == 2 + else 0, + expert_to_weights_scale.stride(2) + if expert_to_weights_scale is not None and expert_to_weights_scale.ndim == 3 + else 0, token_inputs, token_inputs.stride(0), token_inputs.stride(1), @@ -496,9 +502,15 @@ def grouped_matmul( topk_num, token_input_scale, expert_to_weights_scale, - expert_to_weights_scale.stride(0), - expert_to_weights_scale.stride(1), - expert_to_weights_scale.stride(2), + expert_to_weights_scale.stride(0) + if expert_to_weights_scale is not None and expert_to_weights_scale.ndim == 2 + else 0, + expert_to_weights_scale.stride(1) + if expert_to_weights_scale is not None and expert_to_weights_scale.ndim == 2 + else 0, + expert_to_weights_scale.stride(2) + if expert_to_weights_scale is not None and expert_to_weights_scale.ndim == 3 + else 0, token_inputs, token_inputs.stride(0), token_inputs.stride(1),