33
33
from vllm .transformers_utils .configs import (ChatGLMConfig , Cohere2Config ,
34
34
DbrxConfig , DeepseekVLV2Config ,
35
35
EAGLEConfig , ExaoneConfig ,
36
- H2OVLChatConfig ,
37
- InternVLChatConfig , JAISConfig ,
38
- KimiVLConfig , MedusaConfig ,
39
- MiniMaxText01Config ,
36
+ JAISConfig , KimiVLConfig ,
37
+ MedusaConfig , MiniMaxText01Config ,
40
38
MiniMaxVL01Config , MllamaConfig ,
41
39
MLPSpeculatorConfig , MPTConfig ,
42
40
NemotronConfig , NVLM_D_Config ,
@@ -90,8 +88,6 @@ def _get_hf_token() -> Optional[str]:
90
88
"medusa" : MedusaConfig ,
91
89
"eagle" : EAGLEConfig ,
92
90
"exaone" : ExaoneConfig ,
93
- "h2ovl_chat" : H2OVLChatConfig ,
94
- "internvl_chat" : InternVLChatConfig ,
95
91
"minimax_text_01" : MiniMaxText01Config ,
96
92
"minimax_vl_01" : MiniMaxVL01Config ,
97
93
"nemotron" : NemotronConfig ,
@@ -104,6 +100,10 @@ def _get_hf_token() -> Optional[str]:
104
100
** _CONFIG_REGISTRY_OVERRIDE_HF
105
101
}
106
102
103
+ _CONFIG_ATTRS_MAPPING : dict [str , str ] = {
104
+ "llm_config" : "text_config" ,
105
+ }
106
+
107
107
108
108
class ConfigFormat (str , enum .Enum ):
109
109
AUTO = "auto"
@@ -286,6 +286,18 @@ def is_encoder_decoder(config: PretrainedConfig) -> bool:
286
286
return getattr (config , "is_encoder_decoder" , False )
287
287
288
288
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
+
289
301
def get_config (
290
302
model : Union [str , Path ],
291
303
trust_remote_code : bool ,
@@ -361,6 +373,9 @@ def get_config(
361
373
revision = revision ,
362
374
code_revision = code_revision ,
363
375
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 ,
364
379
** kwargs ,
365
380
)
366
381
except ValueError as e :
@@ -376,6 +391,7 @@ def get_config(
376
391
raise RuntimeError (err_msg ) from e
377
392
else :
378
393
raise e
394
+ config = _maybe_remap_hf_config_attrs (config )
379
395
380
396
elif config_format == ConfigFormat .MISTRAL :
381
397
config = load_params_config (model , revision , ** kwargs )
0 commit comments