Skip to content

Commit

Permalink
[Misc] Remove redundant TypeVar from base model (vllm-project#12248)
Browse files Browse the repository at this point in the history
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
  • Loading branch information
DarkLight1337 authored and tjtanaa committed Jan 28, 2025
1 parent 66d6dd2 commit e9ddeda
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions vllm/model_executor/models/interfaces_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import torch
import torch.nn as nn
from transformers import PretrainedConfig
from typing_extensions import TypeIs, TypeVar

from vllm.logger import init_logger
Expand All @@ -19,9 +18,6 @@

logger = init_logger(__name__)

# The type of HF config
C_co = TypeVar("C_co", bound=PretrainedConfig, covariant=True)

# The type of hidden states
# Currently, T = torch.Tensor for all models except for Medusa
# which has T = List[torch.Tensor]
Expand All @@ -34,7 +30,7 @@


@runtime_checkable
class VllmModel(Protocol[C_co, T_co]):
class VllmModel(Protocol[T_co]):
"""The interface required for all models in vLLM."""

def __init__(
Expand Down Expand Up @@ -97,7 +93,7 @@ def is_vllm_model(


@runtime_checkable
class VllmModelForTextGeneration(VllmModel[C_co, T], Protocol[C_co, T]):
class VllmModelForTextGeneration(VllmModel[T], Protocol[T]):
"""The interface required for all generative models in vLLM."""

def compute_logits(
Expand Down Expand Up @@ -143,7 +139,7 @@ def is_text_generation_model(


@runtime_checkable
class VllmModelForPooling(VllmModel[C_co, T], Protocol[C_co, T]):
class VllmModelForPooling(VllmModel[T], Protocol[T]):
"""The interface required for all pooling models in vLLM."""

def pooler(
Expand Down

0 comments on commit e9ddeda

Please sign in to comment.