3636import torch .nn .functional as F
3737from einops import rearrange
3838from transformers import BatchFeature
39- from transformers .models .glm4v .configuration_glm4v import (Glm4vConfig ,
40- Glm4vVisionConfig )
39+ from transformers .models .glm4v .configuration_glm4v import Glm4vVisionConfig
4140from transformers .models .glm4v .image_processing_glm4v import (
4241 Glm4vImageProcessor , smart_resize )
4342from transformers .models .glm4v .video_processing_glm4v import (
@@ -815,7 +814,7 @@ def load_weights(self, weights: Iterable[tuple[str,
815814class Glm4vProcessingInfo (BaseProcessingInfo ):
816815
817816 def get_hf_config (self ):
818- return self .ctx .get_hf_config (Glm4vConfig )
817+ return self .ctx .get_hf_config ()
819818
820819 def get_tokenizer (self ):
821820 return self .ctx .tokenizer
@@ -1259,7 +1258,7 @@ class Glm4vForConditionalGeneration(nn.Module, SupportsMultiModal,
12591258
12601259 def __init__ (self , * , vllm_config : VllmConfig , prefix : str = "" ):
12611260 super ().__init__ ()
1262- config : Glm4vConfig = vllm_config .model_config .hf_config
1261+ config = vllm_config .model_config .hf_config
12631262 quant_config = vllm_config .quant_config
12641263 multimodal_config = vllm_config .model_config .multimodal_config
12651264
@@ -1273,11 +1272,18 @@ def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
12731272 prefix = maybe_prefix (prefix , "visual" ),
12741273 )
12751274
1275+ if config .model_type == "glm4v" :
1276+ architectures = ["Glm4ForCausalLM" ]
1277+ elif config .model_type == "glm4v_moe" :
1278+ architectures = ["Glm4MoeForCausalLM" ]
1279+ else :
1280+ architectures = None
1281+
12761282 self .language_model = init_vllm_registered_model (
12771283 vllm_config = vllm_config ,
1278- prefix = maybe_prefix ( prefix , "" ) ,
1279- architectures = [ "Glm4ForCausalLM" ] ,
1280- )
1284+ hf_config = config . text_config ,
1285+ prefix = maybe_prefix ( prefix , "language_model" ) ,
1286+ architectures = architectures )
12811287
12821288 self .make_empty_intermediate_tensors = (
12831289 self .language_model .make_empty_intermediate_tensors )
0 commit comments