[Model] Support DeepSeek-V4.1-Flash (#56214)

Signed-off-by: Yongye Zhu <zyy1102000@gmail.com>
Signed-off-by: Jee Jee Li <jeejeelee@inferact.ai>
Signed-off-by: andyluo7 <andy.luo@amd.com>
Signed-off-by: zjy0516 <riverclouds.zhu@qq.com>
Co-authored-by: Jee Jee Li <jeejeelee@inferact.ai>
Co-authored-by: andyluo7 <andy.luo@amd.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: zjy0516 <riverclouds.zhu@qq.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yongye Zhu
2026-09-11 02:11:19 -07:00
committed by GitHub
co-authored by Jee Jee Li andyluo7 OpenAI Codex zjy0516 Claude Opus 5
parent e6821ceac9
commit e77daef89e
49 changed files with 3996 additions and 138 deletions
+19 -9
View File
@@ -15,6 +15,14 @@ if TYPE_CHECKING:
logger = init_logger(__name__)
# Architecture -> the hf_text_config field naming its n-gram layers. A model is
# only configurable here if it actually has such layers to store.
_NGRAM_LAYER_FIELDS = {
"DeepseekV41ForCausalLM": "engram_layer_ids",
"Qwen4ExpForCausalLM": "ple_layer_ids",
"Qwen4ExpForConditionalGeneration": "ple_layer_ids",
}
def _default_cpu_offload() -> bool:
"""Honor the legacy environment variable only when the field is omitted."""
@@ -40,23 +48,25 @@ class EngramConfig:
Otherwise, each DP rank has a separate TP-sharded embedding replica."""
def verify_model_config(self, model_config: "ModelConfig | None") -> None:
"""Reject Engram configuration for models without supported embeddings."""
"""Reject Engram configuration for models without n-gram embeddings."""
from vllm.platforms import current_platform
supported_architectures = {
"Qwen4ExpForCausalLM",
"Qwen4ExpForConditionalGeneration",
}
field = (
_NGRAM_LAYER_FIELDS.get(model_config.architecture)
if model_config is not None
else None
)
if (
model_config is None
or model_config.architecture not in supported_architectures
or field is None
or not current_platform.is_cuda()
or not getattr(model_config.hf_text_config, "ple_layer_ids", None)
or not getattr(model_config.hf_text_config, field, None)
):
raise ValueError(
"EngramConfig requires a model with supported Engram "
"embeddings. Currently only the CUDA Qwen4Exp implementation "
"with non-empty ple_layer_ids is supported."
"embeddings. Currently only the CUDA Qwen4Exp and DeepSeek "
"V4.1 implementations with non-empty n-gram layer ids are "
"supported."
)
def verify_parallel_config(self, parallel_config: "ParallelConfig") -> None: