A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 9, 10:00 UTC
[BugFix] Fix EPLB fail for MoeFP4 model with Marlin backend (#33262)
Signed-off-by: ilmarkov <markovilya197@gmail.com>
Ilya Markov committed
Jan 29, 2026 at 09:52 UTC
53fc16640281a939e01c98be80fa67179ba9a088
1 file changed
+10
-2
vllm/model_executor/utils.py
+10
-2
@@ -44,7 +44,9 @@ def set_weight_attrs(
44
setattr(weight, key, value)
45
46
47
-def replace_parameter(layer: torch.nn.Module, param_name: str, new_data: torch.Tensor):
47
+def replace_parameter(
48
+ layer: torch.nn.Module, param_name: str, new_data: torch.Tensor | None
49
+):
50
"""
51
Replace a parameter of a layer while maintaining the ability to reload the weight.
52
Called within implementations of the `process_weights_after_loading` method.
@@ -54,9 +56,15 @@ def replace_parameter(layer: torch.nn.Module, param_name: str, new_data: torch.T
56
Args:
57
layer: Layer containing parameter to replace
58
param_name: Name of parameter to replace
57
- new_data: New data of the new parameter
59
+ new_data: New data of the new parameter, or None to set the parameter to None
60
"""
61
# should not be used on a tied/shared param
62
+
63
+ # If new_data is None, set the parameter to None
64
+ if new_data is None:
65
+ setattr(layer, param_name, None)
66
+ return
67
+
68
if isinstance(new_data, torch.nn.Parameter):
69
new_data = new_data.data
70
new_param = torch.nn.Parameter(new_data, requires_grad=False)