Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Misc] Remove redundant TypeVar from base model #12248

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading