From 4a2b2a7f1aa1e528d96c97461ceb1c19a3540ff7 Mon Sep 17 00:00:00 2001 From: Jonathan Borduas <10748104+jobordu@users.noreply.github.com> Date: Mon, 14 Sep 2026 07:54:07 +0100 Subject: [PATCH 1/2] fix(awq_sm70_moe): register int32 buffer Parameters with requires_grad=False MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The AWQ SM_70 MoE weight path wraps raw int32 buffers (qweight, qzeros) via the _set_parameter helper. vLLM >2.x's nn.Parameter ctor emits a UserWarning when an int tensor is registered with requires_grad=True (the default) — the parameter would be silently unusable for autograd anyway, but the warning pollutes boot logs and surfaces as noise on long-running inference servers. The current code calls param.requires_grad_(False) on the next line, which DOES turn the flag off, but only AFTER the ctor warning has already fired. Pass requires_grad=False into the constructor directly so the warning never emits, and keep the in-place guard as a no-op for the already-Parameter branch. Repro (was): >>> import torch >>> import torch.nn as nn >>> _set_parameter(layer, 'name', torch.empty(4, dtype=torch.int32)) UserWarning: Only Tensors of floating point and complex dtype can require gradients After this PR: >>> _set_parameter(layer, 'name', torch.empty(4, dtype=torch.int32)) # no warning; layer.name.requires_grad is False The six explicit Parameter(torch.empty(...), requires_grad=False) sites in process_weights_after_loading already pass the flag through the ctor for the same reason — this PR closes the same gap on the helper that the qweight/qzeros constructors delegate to. Targeted file only; no behavioural change for float tensors. --- vllm/model_executor/layers/quantization/awq_sm70_moe.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vllm/model_executor/layers/quantization/awq_sm70_moe.py b/vllm/model_executor/layers/quantization/awq_sm70_moe.py index 55c04916ee..1378da1b85 100644 --- a/vllm/model_executor/layers/quantization/awq_sm70_moe.py +++ b/vllm/model_executor/layers/quantization/awq_sm70_moe.py @@ -503,7 +503,12 @@ def _set_parameter( name: str, value: torch.Tensor, ) -> None: - param = value if isinstance(value, Parameter) else Parameter(value) + # Required by int32 torch.empty(int32) buffers: the Parameter ctor itself + # refuses or warns when an int tensor is registered with requires_grad=True + # (the default). Pass the flag in directly so the constructor sees it from + # line one. The trailing param.requires_grad_(False) stays as a no-op + # idempotent guard for the already-Parameter path. + param = value if isinstance(value, Parameter) else Parameter(value, requires_grad=False) param.requires_grad_(False) setattr(layer, name, param) From 8ef32c67854ee5f6bcd905baa3e636596fab2276 Mon Sep 17 00:00:00 2001 From: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com> Date: Sat, 26 Sep 2026 20:18:34 +0800 Subject: [PATCH 2/2] [CI] Format AWQ parameter registration fix Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com> --- vllm/model_executor/layers/quantization/awq_sm70_moe.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vllm/model_executor/layers/quantization/awq_sm70_moe.py b/vllm/model_executor/layers/quantization/awq_sm70_moe.py index 1378da1b85..1d04f5f3ca 100644 --- a/vllm/model_executor/layers/quantization/awq_sm70_moe.py +++ b/vllm/model_executor/layers/quantization/awq_sm70_moe.py @@ -508,7 +508,9 @@ def _set_parameter( # (the default). Pass the flag in directly so the constructor sees it from # line one. The trailing param.requires_grad_(False) stays as a no-op # idempotent guard for the already-Parameter path. - param = value if isinstance(value, Parameter) else Parameter(value, requires_grad=False) + param = ( + value if isinstance(value, Parameter) else Parameter(value, requires_grad=False) + ) param.requires_grad_(False) setattr(layer, name, param)