Skip to content

Commit 64d9ca1

Browse files
author
Varun Sundar Rabindranath
committed
make new parameter
Signed-off-by: Varun Sundar Rabindranath <[email protected]>
1 parent 7440cb4 commit 64d9ca1

File tree

1 file changed

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

1 file changed

+6
-2
lines changed

vllm/model_executor/layers/fused_moe/layer.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,8 +1249,12 @@ def _maybe_make_contiguous(
12491249
# do nothing.
12501250
return p
12511251
assert p.ndim == 3
1252-
p.data = torch.transpose(p.data, 1, 2)
1253-
return p
1252+
# Do not update the layer paramater as the layer's MoE operations would
1253+
# expect the parameter's tensor to the same shape / stride. Instead,
1254+
# make a new torch.nn.Parameter that is used just in the context of
1255+
# EPLB.
1256+
return torch.nn.Parameter(torch.transpose(p.data, 1, 2),
1257+
requires_grad=False)
12541258

12551259
weights = list(self.named_parameters())
12561260
weights = [(name, _maybe_make_contiguous(name, p)) for name, p in weights]

0 commit comments

Comments
 (0)