[Mypy] Fix typing for M models (#54262)

Signed-off-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
This commit is contained in:
Taneem Ibrahim
2026-09-01 11:26:00 -04:00
committed by GitHub
parent d9eb4e344f
commit 76f3249fbd
26 changed files with 512 additions and 200 deletions
+18 -3
View File
@@ -26,6 +26,7 @@
import math
from collections.abc import Iterable
from typing import TYPE_CHECKING
import torch
from torch import nn
@@ -55,6 +56,14 @@ from .utils import (
process_eagle_weight,
)
if TYPE_CHECKING:
class _EagleMiniCPMSupportsPP:
pass
else:
_EagleMiniCPMSupportsPP = SupportsPP
class EagleMiniCPMDecoderLayer(nn.Module):
def __init__(
@@ -149,7 +158,9 @@ class EagleMiniCPMModel(nn.Module):
):
super().__init__()
config = vllm_config.speculative_config.draft_model_config.hf_config
speculative_config = vllm_config.speculative_config
assert speculative_config is not None
config = speculative_config.draft_model_config.hf_config
cache_config = vllm_config.cache_config
quant_config = vllm_config.quant_config
@@ -291,7 +302,9 @@ class EagleMiniCPMModel(nn.Module):
return loaded_params
class EagleMiniCPMForCausalLM(nn.Module, SupportsLoRA, SupportsPP, SupportsEagle):
class EagleMiniCPMForCausalLM(
nn.Module, SupportsLoRA, _EagleMiniCPMSupportsPP, SupportsEagle
):
packed_modules_mapping = {
"qkv_proj": [
"q_proj",
@@ -312,7 +325,9 @@ class EagleMiniCPMForCausalLM(nn.Module, SupportsLoRA, SupportsPP, SupportsEagle
def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
super().__init__()
config = vllm_config.speculative_config.draft_model_config.hf_config
speculative_config = vllm_config.speculative_config
assert speculative_config is not None
config = speculative_config.draft_model_config.hf_config
cache_config = vllm_config.cache_config
quant_config = vllm_config.quant_config