File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
vllm/model_executor/layers/fused_moe Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1411,11 +1411,17 @@ def _maybe_make_contiguous(
14111411 """
14121412 if p .ndim != 3 :
14131413 return p
1414- # Check if the last 2 dimensions are trasposed
1415- is_transposed = p .stride (1 ) == 1 and p .stride (2 ) != 1
1416- if p .is_contiguous () or not is_transposed or "weight_scale" not in name :
1414+ if p .is_contiguous ():
1415+ # Already contiguous. do nothing.
1416+ return p
1417+ # p is non-contiguous. We only handle the case where the last 2
1418+ # dimensions of the scales tensor is transposed. We can handle
1419+ # other cases when they become relevant.
1420+ is_transposed_12 = p .stride (1 ) == 1 and p .stride (2 ) != 1
1421+ if "weight_scale" not in name or not is_transposed_12 :
14171422 # do nothing.
14181423 return p
1424+
14191425 # Do not update the layer paramater as the layer's MoE operations would
14201426 # expect the parameter's tensor to the same shape / stride. Instead,
14211427 # make a new torch.nn.Parameter that is used just in the context of
You can’t perform that action at this time.
0 commit comments