From b77743451c4b6ecd1421bddf4633cb6f4271961b Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 18 Aug 2026 01:58:15 +0000 Subject: [PATCH] =?UTF-8?q?debug:=20rms=5Fnorm=20weight.dim()!=3D1=20?= =?UTF-8?q?=E2=80=94=20=E6=89=93=E5=8D=B0=E5=89=8D20=E6=AC=A1=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E7=9A=84w.shape,=20x.shape,=20class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ex_engine/python/patch_vllm_ops.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ex_engine/python/patch_vllm_ops.py b/ex_engine/python/patch_vllm_ops.py index 3403c73d..d19e79d8 100644 --- a/ex_engine/python/patch_vllm_ops.py +++ b/ex_engine/python/patch_vllm_ops.py @@ -83,11 +83,20 @@ def _patch_layernorm() -> int: _orig_forward = GemmaRMSNorm.forward + _debug_count = [0] + def _patched_forward(self, x, residual=None): # GemmaRMSNorm: output = rms_norm(x) * (1 + weight) # ixformer rms_norm: output = rms_norm(x) * weight # Pass (1 + weight) to ixformer to match GemmaRMSNorm semantics. w = self.weight + if _debug_count[0] < 20: + _debug_count[0] += 1 + logger.info("DEBUG rms_norm #%d: w.shape=%s w.dim=%d x.shape=%s x.dim=%d " + "class=%s residual=%s", + _debug_count[0], list(w.shape), w.dim(), list(x.shape), x.dim(), + type(self).__name__, + list(residual.shape) if residual is not None else None) if w.dim() != 1 or w.shape[0] != x.shape[-1]: return _orig_forward(self, x, residual) w_adjusted = 1.0 + w