[model] Add support for openPangu_Ultra_MoE (#27521)

Signed-off-by: yuantao <2422264527@qq.com>
Signed-off-by: yt0428 <51468697+yt0428@users.noreply.github.com>
Co-authored-by: Jee Jee Li <pandaleefree@gmail.com>
This commit is contained in:
yt0428
2025-11-05 00:17:20 +08:00
committed by GitHub
parent 5fd8f02ea9
commit 05cae69f0f
8 changed files with 1379 additions and 1 deletions

View File

@@ -41,6 +41,7 @@ SpeculativeMethod = Literal[
"qwen3_next_mtp",
"mimo_mtp",
"longcat_flash_mtp",
"pangu_ultra_moe_mtp",
"mtp",
"suffix",
]
@@ -51,6 +52,7 @@ MTP_MODEL_TYPES = (
"ernie_mtp",
"qwen3_next_mtp",
"longcat_flash_mtp",
"pangu_ultra_moe_mtp",
)
@@ -179,6 +181,13 @@ class SpeculativeConfig:
hf_config.update(
{"n_predict": n_predict, "architectures": ["DeepSeekMTPModel"]}
)
if hf_config.model_type in ("pangu_ultra_moe"):
hf_config.model_type = "pangu_ultra_moe_mtp"
if hf_config.model_type == "pangu_ultra_moe_mtp":
n_predict = getattr(hf_config, "num_nextn_predict_layers", None)
hf_config.update(
{"n_predict": n_predict, "architectures": ["OpenPanguMTPModel"]}
)
if hf_config.architectures[0] == "MiMoForCausalLM":
hf_config.model_type = "mimo_mtp"