3333from vllm .transformers_utils .configs import (ChatGLMConfig , Cohere2Config ,
3434 DbrxConfig , DeepseekVLV2Config ,
3535 EAGLEConfig , ExaoneConfig ,
36- H2OVLChatConfig ,
37- InternVLChatConfig , JAISConfig ,
38- KimiVLConfig , MedusaConfig ,
39- MiniMaxText01Config ,
36+ JAISConfig , KimiVLConfig ,
37+ MedusaConfig , MiniMaxText01Config ,
4038 MiniMaxVL01Config , MllamaConfig ,
4139 MLPSpeculatorConfig , MPTConfig ,
4240 NemotronConfig , NVLM_D_Config ,
@@ -90,8 +88,6 @@ def _get_hf_token() -> Optional[str]:
9088 "medusa" : MedusaConfig ,
9189 "eagle" : EAGLEConfig ,
9290 "exaone" : ExaoneConfig ,
93- "h2ovl_chat" : H2OVLChatConfig ,
94- "internvl_chat" : InternVLChatConfig ,
9591 "minimax_text_01" : MiniMaxText01Config ,
9692 "minimax_vl_01" : MiniMaxVL01Config ,
9793 "nemotron" : NemotronConfig ,
@@ -104,6 +100,10 @@ def _get_hf_token() -> Optional[str]:
104100 ** _CONFIG_REGISTRY_OVERRIDE_HF
105101}
106102
103+ _CONFIG_ATTRS_MAPPING : dict [str , str ] = {
104+ "llm_config" : "text_config" ,
105+ }
106+
107107
108108class ConfigFormat (str , enum .Enum ):
109109 AUTO = "auto"
@@ -286,6 +286,18 @@ def is_encoder_decoder(config: PretrainedConfig) -> bool:
286286 return getattr (config , "is_encoder_decoder" , False )
287287
288288
289+ def _maybe_remap_hf_config_attrs (config : PretrainedConfig ) -> PretrainedConfig :
290+ """Remap config attributes to match the expected names."""
291+ for old_attr , new_attr in _CONFIG_ATTRS_MAPPING .items ():
292+ if hasattr (config , old_attr ):
293+ if not hasattr (config , new_attr ):
294+ config .update ({new_attr : getattr (config , old_attr )})
295+ delattr (config , old_attr )
296+ logger .debug ("Remapped config attribute '%s' to '%s'" , old_attr ,
297+ new_attr )
298+ return config
299+
300+
289301def get_config (
290302 model : Union [str , Path ],
291303 trust_remote_code : bool ,
@@ -361,6 +373,9 @@ def get_config(
361373 revision = revision ,
362374 code_revision = code_revision ,
363375 token = _get_hf_token (),
376+ # some old custom model's config needs
377+ # `has_no_defaults_at_init=True` to work.
378+ has_no_defaults_at_init = trust_remote_code ,
364379 ** kwargs ,
365380 )
366381 except ValueError as e :
@@ -376,6 +391,7 @@ def get_config(
376391 raise RuntimeError (err_msg ) from e
377392 else :
378393 raise e
394+ config = _maybe_remap_hf_config_attrs (config )
379395
380396 elif config_format == ConfigFormat .MISTRAL :
381397 config = load_params_config (model , revision , ** kwargs )
0 commit comments