[Bugfix][Model][Spec Decode] Defer disposable GLM MTP head (#55442)
Signed-off-by: Luca Motz <luca.motz@icloud.com>
This commit is contained in:
@@ -5,6 +5,7 @@ from unittest import mock
|
||||
|
||||
import pytest
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
|
||||
from tests.v1.attention.utils import (
|
||||
BatchSpec,
|
||||
@@ -31,6 +32,31 @@ mimo_7b_dir = "XiaomiMiMo/MiMo-7B-Base"
|
||||
DEVICE_TYPE = current_platform.device_type
|
||||
|
||||
|
||||
def test_glm_mtp_defers_lm_head(default_vllm_config):
|
||||
from vllm.model_executor.models import deepseek_mtp
|
||||
from vllm.models.glm5next.common import mtp
|
||||
|
||||
config = mock.MagicMock(
|
||||
hidden_size=16,
|
||||
rms_norm_eps=1e-5,
|
||||
index_topk=8,
|
||||
index_kpool=4,
|
||||
)
|
||||
vllm_config = mock.MagicMock()
|
||||
vllm_config.speculative_config.draft_model_config.hf_config = config
|
||||
vllm_config.scheduler_config.max_num_batched_tokens = 4
|
||||
|
||||
with (
|
||||
mock.patch.object(mtp, "Glm5NextDecoderLayer", return_value=nn.Identity()),
|
||||
mock.patch.object(deepseek_mtp, "ParallelLMHead") as parallel_lm_head,
|
||||
mock.patch.object(mtp.current_platform, "device_type", "cpu"),
|
||||
):
|
||||
layer = mtp.Glm5NextMultiTokenPredictorLayer(vllm_config, "model.layers.1")
|
||||
|
||||
parallel_lm_head.assert_not_called()
|
||||
assert layer.shared_head.head is None
|
||||
|
||||
|
||||
def _create_mtp_proposer(num_speculative_tokens: int) -> EagleProposer:
|
||||
"""Create an MTP proposer with unified model configuration."""
|
||||
model_config = ModelConfig(
|
||||
|
||||
Reference in New Issue
Block a user