[Perf] GLM Image (#920)

Signed-off-by: JaredforReal <w13431838023@gmail.com>
Signed-off-by: Jared Wen <w13431838023@gmail.com>
Signed-off-by: Hongsheng Liu <liuhongsheng4@huawei.com>
Co-authored-by: 汪志鹏 <wangzhipeng628@gmail.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
authored and GitHub committed 2026-02-27 10:29:14 +08:00
1 parent f6ed1bc4e7
commit 4146095623
25 files changed
+5182 -221

No files matched your search

+26
View File
@@ -17,6 +17,32 @@ from vllm_omni.inputs.data import OmniTokensPrompt
from vllm_omni.model_executor.layers.rotary_embedding import OmniMRotaryEmbedding
from vllm_omni.request import OmniRequest
# =============================================================================
# Patch GlmImageTextConfig to expose mrope_section in rope_parameters
# =============================================================================
# GLM-Image uses M-RoPE with mrope_section: [8, 12, 12], but transformers'
# implementation doesn't expose it in rope_parameters. vLLM's uses_mrope
# detection relies on "mrope_section" being present in rope_parameters.
# This patch ensures proper M-RoPE detection for GLM-Image.
try:
from transformers.models.glm_image.configuration_glm_image import GlmImageTextConfig
_original_glm_image_text_config_init = GlmImageTextConfig.__init__
def _patched_glm_image_text_config_init(self, *args, **kwargs):
_original_glm_image_text_config_init(self, *args, **kwargs)
# Ensure rope_parameters exists and contains mrope_section
if self.rope_parameters is None:
self.rope_parameters = {}
if isinstance(self.rope_parameters, dict) and "mrope_section" not in self.rope_parameters:
# GLM-Image uses mrope_section: [8, 12, 12] for T/H/W dimensions
self.rope_parameters["mrope_section"] = [8, 12, 12]
GlmImageTextConfig.__init__ = _patched_glm_image_text_config_init
except ImportError:
# GlmImageTextConfig not available, skip patching
pass
# Extend RequestStatus enum with omni-specific statuses
if not hasattr(RequestStatus, "WAITING_FOR_CHUNK"):
# The value - 1 is intentionally chosen to ensure it is treated