[Bugfix][GLM-5.3-Flash] Restore MTP index sharing across draft iterations (#61079)

Signed-off-by: Canlin <canlinguosdu@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Canlin Guo
2026-10-12 05:41:52 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent d4e92ccc37
commit fe4df3df0e
2 changed files with 28 additions and 3 deletions
@@ -15,7 +15,7 @@ import functools
from unittest.mock import MagicMock, patch
import pytest
from transformers import PreTrainedConfig
from transformers import Glm5NextConfig, PreTrainedConfig
from vllm.config.parallel import ParallelConfig
from vllm.config.speculative import SpeculativeConfig
@@ -270,3 +270,21 @@ def test_mtp_index_share_override(
speculative_config.draft_model_config.hf_config.index_share_for_mtp_iteration
is expected
)
@pytest.mark.cpu_test
def test_glm5_next_mtp_override_promotes_index_share():
"""The flag lives on text_config, but the MTP proposers read the draft config."""
config = Glm5NextConfig(
architectures=["Glm5NextForConditionalGeneration"],
text_config={
"num_nextn_predict_layers": 1,
"index_share_for_mtp_iteration": True,
},
)
draft_config = SpeculativeConfig.hf_config_override(config)
assert draft_config.architectures == ["Glm5NextMTPModel"]
assert draft_config.n_predict == 1
assert draft_config.index_share_for_mtp_iteration is True
+9 -2
View File
@@ -1058,9 +1058,16 @@ class SpeculativeConfig:
)
if hf_config.model_type == "glm5_next":
hf_config.model_type = "glm5_next_mtp"
n_predict = hf_config.get_text_config().num_nextn_predict_layers
text_config = hf_config.get_text_config()
share_mtp_indices = getattr(
text_config, "index_share_for_mtp_iteration", False
)
hf_config.update(
{"n_predict": n_predict, "architectures": ["Glm5NextMTPModel"]}
{
"n_predict": text_config.num_nextn_predict_layers,
"architectures": ["Glm5NextMTPModel"],
"index_share_for_mtp_iteration": share_mtp_indices,
}
)
return hf_config