Interns2mobius support (#51149)

Signed-off-by: Lyu Han <lvhan_028@163.com>
This commit is contained in:
Lyu Han
2026-08-06 10:39:35 +00:00
committed by GitHub
parent e07532b035
commit 22013f74ff
8 changed files with 664 additions and 3 deletions
+16 -3
View File
@@ -538,15 +538,28 @@ class SpeculativeConfig:
"architectures": ["Qwen3_5MoeMTP" if is_moe else "Qwen3_5MTP"],
}
)
if hf_config.model_type == "intern_s2_preview":
if hf_config.model_type in ("intern_s2_preview", "interns2_mobius"):
is_mobius = hf_config.model_type == "interns2_mobius"
text_config = getattr(hf_config, "text_config", None)
is_moe = getattr(text_config, "model_type", None) == "qwen3_5_moe_text"
is_moe = is_mobius or (
getattr(text_config, "model_type", None) == "qwen3_5_moe_text"
)
if is_mobius:
assert text_config is not None
text_config.model_type = "qwen3_5_moe_text"
text_config.num_experts = text_config.mtp_num_experts
text_config.num_experts_per_tok = text_config.mtp_num_experts_per_tok
hf_config.model_type = "qwen3_5_mtp"
n_predict = getattr(text_config, "mtp_num_hidden_layers", None)
architecture = (
"InternS2MobiusMTP"
if is_mobius
else ("Qwen3_5MoeMTP" if is_moe else "Qwen3_5MTP")
)
hf_config.update(
{
"n_predict": n_predict,
"architectures": ["Qwen3_5MoeMTP" if is_moe else "Qwen3_5MTP"],
"architectures": [architecture],
}
)
if hf_config.model_type in ("longcat_flash", "longcat_flash_ngram"):