[Model] Add MiniMax M3 support (#45381)

Signed-off-by: youkaichao <youkaichao@gmail.com>
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com>
Signed-off-by: functionstackx <47992694+functionstackx@users.noreply.github.com>
Signed-off-by: Yongye Zhu <zyy1102000@gmail.com>
Signed-off-by: Jee Jee Li <jeejeelee@inferact.ai>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Co-authored-by: Thien Tran <gau.nernst@yahoo.com.sg>
Co-authored-by: Bugen Zhao <i@bugenzhao.com>
Co-authored-by: Jee Jee Li <pandaleefree@gmail.com>
Co-authored-by: Roger Wang <hey@rogerw.io>
Co-authored-by: functionstackx <47992694+functionstackx@users.noreply.github.com>
Co-authored-by: Yongye Zhu <zyy1102000@gmail.com>
Co-authored-by: Jee Jee Li <jeejeelee@inferact.ai>
This commit is contained in:
youkaichao
2026-06-16 01:01:25 +08:00
committed by GitHub
co-authored by OpenAI Codex Isotr0py Thien Tran Bugen Zhao Jee Jee Li Roger Wang functionstackx Yongye Zhu Jee Jee Li
parent a3195fab7b
commit 0a1c5034f5
108 changed files with 14734 additions and 311 deletions
+6
View File
@@ -9,6 +9,8 @@ from vllm.config.utils import config
from vllm.v1.attention.backends.mla.prefill.registry import MLAPrefillBackendEnum
from vllm.v1.attention.backends.registry import AttentionBackendEnum
IndexerKVDType = Literal["bf16", "fp8", "mxfp4", "nvfp4"]
@config
class AttentionConfig:
@@ -50,6 +52,10 @@ class AttentionConfig:
use_fp4_indexer_cache: bool = False
"""If set, use fp4 indexer cache for dsv32 family model (not support yet)"""
indexer_kv_dtype: IndexerKVDType = "bf16"
"""Data type for the sparse-attention indexer K cache. Quantized formats
(fp8, mxfp4, nvfp4) require indexer kernel support in the backend."""
use_non_causal: bool = False
"""Whether to use non-causal (bidirectional) attention."""
+31
View File
@@ -45,6 +45,7 @@ MTPModelTypes = Literal[
"qwen3_next_mtp",
"qwen3_5_mtp",
"longcat_flash_mtp",
"minimax_m3_mtp",
"mtp",
"pangu_ultra_moe_mtp",
"step3p5_mtp",
@@ -528,6 +529,36 @@ class SpeculativeConfig:
text_config.num_kv_shared_layers = 0
hf_config.update({"n_predict": 1, "architectures": ["Gemma4MTPModel"]})
if (
hf_config.model_type == "minimax_m3_vl"
or initial_architecture == "MiniMaxM3SparseForConditionalGeneration"
):
# MTP modules live on the language model of this VL checkpoint, so
# promote text_config before rewriting it into an MTP config.
quantization_config = getattr(hf_config, "quantization_config", None)
hf_config = getattr(hf_config, "text_config", hf_config)
if (
quantization_config is not None
and getattr(hf_config, "quantization_config", None) is None
):
hf_config.update({"quantization_config": quantization_config})
hf_config.model_type = "minimax_m3_mtp"
n_predict = getattr(hf_config, "num_mtp_modules", 1)
hf_config.update(
{"n_predict": n_predict, "architectures": ["MiniMaxM3MTP"]}
)
elif (
hf_config.model_type == "minimax_m3_mtp"
or initial_architecture == "MiniMaxM3MTP"
):
# Standalone MTP checkpoints already use a flat MTP config with no
# VL wrapper / text_config to promote, so just normalize the
# architecture and derive n_predict from num_mtp_modules.
n_predict = getattr(hf_config, "num_mtp_modules", 1)
hf_config.update(
{"n_predict": n_predict, "architectures": ["MiniMaxM3MTP"]}
)
return hf_config
def __post_init__(self):
+9 -3
View File
@@ -1101,20 +1101,26 @@ class VllmConfig:
)
self.compilation_config.mode = CompilationMode.NONE
# DeepSeek V4's model classes don't carry @support_torch_compile —
# For model classes don't carry @support_torch_compile —
# the breakable cudagraph is the supported PIECEWISE path. Auto-enable
# it unless the user has explicitly opted out via the env var.
if (
self.model_config is not None
and "VLLM_USE_BREAKABLE_CUDAGRAPH" not in os.environ
and any(
a in ("DeepseekV4ForCausalLM", "DeepSeekV4MTPModel")
a
in (
"DeepseekV4ForCausalLM",
"DeepSeekV4MTPModel",
"MiniMaxM3SparseForCausalLM",
"MiniMaxM3SparseForConditionalGeneration",
)
for a in self.model_config.architectures
)
):
os.environ["VLLM_USE_BREAKABLE_CUDAGRAPH"] = "1"
logger.info_once(
"Auto-enabling VLLM_USE_BREAKABLE_CUDAGRAPH=1 for DeepSeek V4. "
"Auto-enabling VLLM_USE_BREAKABLE_CUDAGRAPH=1. "
"Set VLLM_USE_BREAKABLE_CUDAGRAPH=0 to opt out."
)