Skip to content

Commit 24eac4b

Browse files
author
Varun Sundar Rabindranath
committed
guard ndim==3
Signed-off-by: Varun Sundar Rabindranath <[email protected]>
1 parent 1a0a89a commit 24eac4b

File tree

1 file changed

+2
-1
lines changed
  • vllm/model_executor/layers/fused_moe

1 file changed

+2
-1
lines changed

vllm/model_executor/layers/fused_moe/layer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,12 +1409,13 @@ def _maybe_make_contiguous(
14091409
Note: This function handles the "weight_scale" tensors specifically.
14101410
This could however be generalized to handle similar tensors.
14111411
"""
1412+
if p.ndim != 3:
1413+
return p
14121414
# Check if the last 2 dimensions are trasposed
14131415
is_transposed = p.stride(1) == 1 and p.stride(2) != 1
14141416
if p.is_contiguous() or not is_transposed or "weight_scale" not in name:
14151417
# do nothing.
14161418
return p
1417-
assert p.ndim == 3
14181419
# Do not update the layer paramater as the layer's MoE operations would
14191420
# expect the parameter's tensor to the same shape / stride. Instead,
14201421
# make a new torch.nn.Parameter that is used just in the context of

0 commit comments

Comments
 (0)