fix: change class name of GLM-ASR (#15772)
This commit is contained in:
@@ -1047,7 +1047,7 @@ multimodal_model_archs = [
|
|||||||
"Gemma3nForConditionalGeneration",
|
"Gemma3nForConditionalGeneration",
|
||||||
"Glm4vForConditionalGeneration",
|
"Glm4vForConditionalGeneration",
|
||||||
"Glm4vMoeForConditionalGeneration",
|
"Glm4vMoeForConditionalGeneration",
|
||||||
"GlmasrForConditionalGeneration",
|
"GlmAsrForConditionalGeneration",
|
||||||
"Grok1VForCausalLM",
|
"Grok1VForCausalLM",
|
||||||
"Grok1AForCausalLM",
|
"Grok1AForCausalLM",
|
||||||
"LlavaLlamaForCausalLM",
|
"LlavaLlamaForCausalLM",
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ from typing import Any, Iterable, List, Optional, Tuple
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from transformers import GlmasrConfig, GlmasrEncoderConfig
|
from transformers import GlmAsrConfig, GlmAsrEncoderConfig
|
||||||
from transformers.models.glmasr.modeling_glmasr import (
|
from transformers.models.glmasr.modeling_glmasr import (
|
||||||
GlmasrEncoder,
|
GlmAsrEncoder,
|
||||||
GlmasrMultiModalProjector,
|
GlmAsrMultiModalProjector,
|
||||||
)
|
)
|
||||||
|
|
||||||
from sglang.srt.layers.quantization.base_config import QuantizationConfig
|
from sglang.srt.layers.quantization.base_config import QuantizationConfig
|
||||||
@@ -46,7 +46,7 @@ from sglang.srt.utils import add_prefix
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class GlmasrForConditionalGeneration(nn.Module):
|
class GlmAsrForConditionalGeneration(nn.Module):
|
||||||
# BitandBytes specific attributes
|
# BitandBytes specific attributes
|
||||||
default_bitsandbytes_target_modules = [
|
default_bitsandbytes_target_modules = [
|
||||||
".gate_proj.",
|
".gate_proj.",
|
||||||
@@ -68,7 +68,7 @@ class GlmasrForConditionalGeneration(nn.Module):
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
config: GlmasrConfig,
|
config: GlmAsrConfig,
|
||||||
quant_config: Optional[QuantizationConfig] = None,
|
quant_config: Optional[QuantizationConfig] = None,
|
||||||
prefix: str = "",
|
prefix: str = "",
|
||||||
) -> None:
|
) -> None:
|
||||||
@@ -77,12 +77,12 @@ class GlmasrForConditionalGeneration(nn.Module):
|
|||||||
self.config = config
|
self.config = config
|
||||||
|
|
||||||
if getattr(self.config, "audio_config", None) is None:
|
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,
|
config.audio_config,
|
||||||
)
|
)
|
||||||
self.multi_modal_projector = GlmasrMultiModalProjector(config)
|
self.multi_modal_projector = GlmAsrMultiModalProjector(config)
|
||||||
self.language_model = LlamaForCausalLM(
|
self.language_model = LlamaForCausalLM(
|
||||||
config.text_config, quant_config, prefix=add_prefix("model", prefix)
|
config.text_config, quant_config, prefix=add_prefix("model", prefix)
|
||||||
)
|
)
|
||||||
@@ -168,4 +168,4 @@ class GlmasrForConditionalGeneration(nn.Module):
|
|||||||
weight_loader(param, loaded_weight)
|
weight_loader(param, loaded_weight)
|
||||||
|
|
||||||
|
|
||||||
EntryClass = GlmasrForConditionalGeneration
|
EntryClass = GlmAsrForConditionalGeneration
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ class BaseMultimodalProcessor(ABC):
|
|||||||
if audios:
|
if audios:
|
||||||
if self._processor.__class__.__name__ in {
|
if self._processor.__class__.__name__ in {
|
||||||
"Gemma3nProcessor",
|
"Gemma3nProcessor",
|
||||||
"GlmasrProcessor",
|
"GlmAsrProcessor",
|
||||||
"Qwen2AudioProcessor",
|
"Qwen2AudioProcessor",
|
||||||
"Qwen3OmniMoeProcessor",
|
"Qwen3OmniMoeProcessor",
|
||||||
}:
|
}:
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from sglang.srt.models.glmasr import GlmasrForConditionalGeneration
|
from sglang.srt.models.glmasr import GlmAsrForConditionalGeneration
|
||||||
from sglang.srt.multimodal.processors.base_processor import (
|
from sglang.srt.multimodal.processors.base_processor import (
|
||||||
BaseMultimodalProcessor,
|
BaseMultimodalProcessor,
|
||||||
MultimodalSpecialTokens,
|
MultimodalSpecialTokens,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class GlmasrProcessor(BaseMultimodalProcessor):
|
class GlmAsrProcessor(BaseMultimodalProcessor):
|
||||||
models = [GlmasrForConditionalGeneration]
|
models = [GlmAsrForConditionalGeneration]
|
||||||
|
|
||||||
def __init__(self, hf_config, server_args, _processor, *args, **kwargs):
|
def __init__(self, hf_config, server_args, _processor, *args, **kwargs):
|
||||||
super().__init__(hf_config, server_args, _processor, *args, **kwargs)
|
super().__init__(hf_config, server_args, _processor, *args, **kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user