From 9c8d4641ff6415a640352a950b98e312479ddf6a Mon Sep 17 00:00:00 2001 From: Void <18275976+yilin-void@users.noreply.github.com> Date: Wed, 16 Sep 2026 15:32:53 +0800 Subject: [PATCH] [Fix] Fix GLM5 mHC PP forward (#39720) --- python/sglang/srt/models/glm5_next.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/models/glm5_next.py b/python/sglang/srt/models/glm5_next.py index c6ec66530..9a5f4d4d2 100644 --- a/python/sglang/srt/models/glm5_next.py +++ b/python/sglang/srt/models/glm5_next.py @@ -981,7 +981,8 @@ class Glm5NextModel(nn.Module): else: assert pp_proxy_tensors is not None hidden_states = pp_proxy_tensors["hidden_states"] - residual = pp_proxy_tensors["residual"] + # mHC carries its residual streams in hidden_states across PP stages. + residual = None if self.config.mhc else pp_proxy_tensors["residual"] device = hidden_states.device zero_allocator = BumpAllocator( buffer_size=total_num_layers * 2 * (2 if forward_batch.can_run_tbo else 1), @@ -1059,6 +1060,8 @@ class Glm5NextModel(nn.Module): ) if not self.pp_group.is_last_rank: + if self.config.mhc: + return PPProxyTensors({"hidden_states": hidden_states}) return PPProxyTensors( { "hidden_states": hidden_states,