From f3ba711662622dffde8d3cb7e464cfd5e5188765 Mon Sep 17 00:00:00 2001 From: Yuxuan Zhang <2448370773@qq.com> Date: Fri, 26 Dec 2025 00:15:16 +0800 Subject: [PATCH] fix: change class name of GLM-ASR (#15772) --- python/sglang/srt/configs/model_config.py | 2 +- python/sglang/srt/models/glmasr.py | 18 +++++++++--------- .../multimodal/processors/base_processor.py | 2 +- .../sglang/srt/multimodal/processors/glmasr.py | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/python/sglang/srt/configs/model_config.py b/python/sglang/srt/configs/model_config.py index 672e4d62e..8cc95abc5 100644 --- a/python/sglang/srt/configs/model_config.py +++ b/python/sglang/srt/configs/model_config.py @@ -1047,7 +1047,7 @@ multimodal_model_archs = [ "Gemma3nForConditionalGeneration", "Glm4vForConditionalGeneration", "Glm4vMoeForConditionalGeneration", - "GlmasrForConditionalGeneration", + "GlmAsrForConditionalGeneration", "Grok1VForCausalLM", "Grok1AForCausalLM", "LlavaLlamaForCausalLM", diff --git a/python/sglang/srt/models/glmasr.py b/python/sglang/srt/models/glmasr.py index 9ff374659..d19f80f92 100644 --- a/python/sglang/srt/models/glmasr.py +++ b/python/sglang/srt/models/glmasr.py @@ -22,10 +22,10 @@ from typing import Any, Iterable, List, Optional, Tuple import torch import torch.nn as nn -from transformers import GlmasrConfig, GlmasrEncoderConfig +from transformers import GlmAsrConfig, GlmAsrEncoderConfig from transformers.models.glmasr.modeling_glmasr import ( - GlmasrEncoder, - GlmasrMultiModalProjector, + GlmAsrEncoder, + GlmAsrMultiModalProjector, ) from sglang.srt.layers.quantization.base_config import QuantizationConfig @@ -46,7 +46,7 @@ from sglang.srt.utils import add_prefix logger = logging.getLogger(__name__) -class GlmasrForConditionalGeneration(nn.Module): +class GlmAsrForConditionalGeneration(nn.Module): # BitandBytes specific attributes default_bitsandbytes_target_modules = [ ".gate_proj.", @@ -68,7 +68,7 @@ class GlmasrForConditionalGeneration(nn.Module): def __init__( self, - config: GlmasrConfig, + config: GlmAsrConfig, quant_config: Optional[QuantizationConfig] = None, prefix: str = "", ) -> None: @@ -77,12 +77,12 @@ class GlmasrForConditionalGeneration(nn.Module): self.config = config if getattr(self.config, "audio_config", None) is None: - self.config.audio_config = GlmasrEncoderConfig(self.config._name_or_path) + self.config.audio_config = GlmAsrEncoderConfig(self.config._name_or_path) - self.audio_tower = GlmasrEncoder( + self.audio_tower = GlmAsrEncoder( config.audio_config, ) - self.multi_modal_projector = GlmasrMultiModalProjector(config) + self.multi_modal_projector = GlmAsrMultiModalProjector(config) self.language_model = LlamaForCausalLM( config.text_config, quant_config, prefix=add_prefix("model", prefix) ) @@ -168,4 +168,4 @@ class GlmasrForConditionalGeneration(nn.Module): weight_loader(param, loaded_weight) -EntryClass = GlmasrForConditionalGeneration +EntryClass = GlmAsrForConditionalGeneration diff --git a/python/sglang/srt/multimodal/processors/base_processor.py b/python/sglang/srt/multimodal/processors/base_processor.py index 76494a215..ca0dc1f57 100644 --- a/python/sglang/srt/multimodal/processors/base_processor.py +++ b/python/sglang/srt/multimodal/processors/base_processor.py @@ -299,7 +299,7 @@ class BaseMultimodalProcessor(ABC): if audios: if self._processor.__class__.__name__ in { "Gemma3nProcessor", - "GlmasrProcessor", + "GlmAsrProcessor", "Qwen2AudioProcessor", "Qwen3OmniMoeProcessor", }: diff --git a/python/sglang/srt/multimodal/processors/glmasr.py b/python/sglang/srt/multimodal/processors/glmasr.py index 2229b0bcb..cebeb1f6a 100644 --- a/python/sglang/srt/multimodal/processors/glmasr.py +++ b/python/sglang/srt/multimodal/processors/glmasr.py @@ -1,14 +1,14 @@ import re -from sglang.srt.models.glmasr import GlmasrForConditionalGeneration +from sglang.srt.models.glmasr import GlmAsrForConditionalGeneration from sglang.srt.multimodal.processors.base_processor import ( BaseMultimodalProcessor, MultimodalSpecialTokens, ) -class GlmasrProcessor(BaseMultimodalProcessor): - models = [GlmasrForConditionalGeneration] +class GlmAsrProcessor(BaseMultimodalProcessor): + models = [GlmAsrForConditionalGeneration] def __init__(self, hf_config, server_args, _processor, *args, **kwargs): super().__init__(hf_config, server_args, _processor, *args, **kwargs)