add deepseekv3 and llama4

This commit is contained in:
Chranos
2026-02-11 15:03:30 +08:00
parent a21eae79a1
commit 5ed7baa68e

View File

@@ -13,7 +13,7 @@ from transformers import GenerationConfig, PretrainedConfig
from transformers.models.auto.image_processing_auto import ( from transformers.models.auto.image_processing_auto import (
get_image_processor_config) get_image_processor_config)
from transformers.models.auto.modeling_auto import ( from transformers.models.auto.modeling_auto import (
MODEL_FOR_CAUSAL_LM_MAPPING_NAMES) MODEL_FOR_CAUSAL_LM_MAPPING_NAMES, MODEL_MAPPING_NAMES)
from transformers.utils import CONFIG_NAME as HF_CONFIG_NAME from transformers.utils import CONFIG_NAME as HF_CONFIG_NAME
from vllm.envs import VLLM_USE_MODELSCOPE from vllm.envs import VLLM_USE_MODELSCOPE
@@ -229,13 +229,16 @@ def get_config(
model_type = MODEL_FOR_CAUSAL_LM_MAPPING_NAMES[config.model_type] model_type = MODEL_FOR_CAUSAL_LM_MAPPING_NAMES[config.model_type]
config.update({"architectures": [model_type]}) config.update({"architectures": [model_type]})
# Some composite config classes (e.g. Llama4Config) may not preserve # Architecture mapping for models without explicit architectures field
# the 'architectures' field from config.json. Restore it from the if not getattr(config, "architectures", None):
# raw config_dict if needed. if config.model_type not in MODEL_MAPPING_NAMES:
if config_format == ConfigFormat.HF: logger.warning(
raw_archs = config_dict.get("architectures") "Model config does not have a top-level 'architectures' "
if raw_archs and not getattr(config, "architectures", None): "field: expecting `hf_overrides={'architectures': "
config.architectures = raw_archs "['...']}` to be passed in engine args.")
else:
model_type = MODEL_MAPPING_NAMES[config.model_type]
config.update({"architectures": [model_type]})
patch_rope_scaling(config) patch_rope_scaling(config)