From c330b687a116be3738120f430ddbb096ca9543a3 Mon Sep 17 00:00:00 2001 From: Xinyuan Tong <115166877+JustinTong0323@users.noreply.github.com> Date: Sat, 14 Mar 2026 04:48:28 +0000 Subject: [PATCH] [Bugfix] Fix GLM-4.6V vision regression in glm4v_moe and glm_ocr (#20463) --- python/sglang/srt/models/glm4v_moe.py | 3 +++ python/sglang/srt/models/glm_ocr.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/python/sglang/srt/models/glm4v_moe.py b/python/sglang/srt/models/glm4v_moe.py index 324de18b4..0e77d5b3b 100644 --- a/python/sglang/srt/models/glm4v_moe.py +++ b/python/sglang/srt/models/glm4v_moe.py @@ -281,5 +281,8 @@ class Glm4vMoeForConditionalGeneration(Glm4vForConditionalGeneration): else: logger.warning(f"Parameter {name} not found in params_dict") + if not is_nextn: + self.visual.patch_embed.copy_conv3d_weight_to_linear() + EntryClass = [Glm4vMoeForConditionalGeneration] diff --git a/python/sglang/srt/models/glm_ocr.py b/python/sglang/srt/models/glm_ocr.py index c2f4adc4c..ce1d300ab 100644 --- a/python/sglang/srt/models/glm_ocr.py +++ b/python/sglang/srt/models/glm_ocr.py @@ -431,5 +431,8 @@ class GlmOcrForConditionalGeneration(Glm4vForConditionalGeneration): ) weight_loader(param, loaded_weight) + if not is_nextn: + self.visual.patch_embed.copy_conv3d_weight_to_linear() + EntryClass = [GlmOcrForConditionalGeneration]