A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 16, 02:00 UTC
[Misc] Remove redundant TypeVar from base model (#12248)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Cyrus Leung committed
Jan 21, 2025 at 16:40 UTC
f2e9f2a3be6f1dce5a6f01b2263488c6533862ac
1 file changed
+3
-7
vllm/model_executor/models/interfaces_base.py
+3
-7
@@ -3,7 +3,6 @@ from typing import (TYPE_CHECKING, List, Optional, Protocol, Type, Union,
3
4
import torch
5
import torch.nn as nn
6
-from transformers import PretrainedConfig
6
from typing_extensions import TypeIs, TypeVar
7
8
from vllm.logger import init_logger
@@ -19,9 +18,6 @@ if TYPE_CHECKING:
18
19
logger = init_logger(__name__)
20
22
-# The type of HF config
23
-C_co = TypeVar("C_co", bound=PretrainedConfig, covariant=True)
24
-
21
# The type of hidden states
22
# Currently, T = torch.Tensor for all models except for Medusa
23
# which has T = List[torch.Tensor]
@@ -34,7 +30,7 @@ T_co = TypeVar("T_co", default=torch.Tensor, covariant=True)
30
31
32
@runtime_checkable
37
-class VllmModel(Protocol[C_co, T_co]):
33
+class VllmModel(Protocol[T_co]):
34
"""The interface required for all models in vLLM."""
35
36
def __init__(
@@ -97,7 +93,7 @@ def is_vllm_model(
93
94
95
@runtime_checkable
100
-class VllmModelForTextGeneration(VllmModel[C_co, T], Protocol[C_co, T]):
96
+class VllmModelForTextGeneration(VllmModel[T], Protocol[T]):
97
"""The interface required for all generative models in vLLM."""
98
99
def compute_logits(
@@ -143,7 +139,7 @@ def is_text_generation_model(
139
140
141
@runtime_checkable
146
-class VllmModelForPooling(VllmModel[C_co, T], Protocol[C_co, T]):
142
+class VllmModelForPooling(VllmModel[T], Protocol[T]):
143
"""The interface required for all pooling models in vLLM."""
144
145
def pooler(