Skip to content

vllm.model_executor.layers.attention_layer_base

Base class for attention-like layers.

AttentionLayerBase

Bases: ABC

Base class for attention-like layers (Attention, Mamba, etc.) that support the v1 engine.

This provides a common interface for getting attention backends from different layer types.

Source code in vllm/model_executor/layers/attention_layer_base.py
class AttentionLayerBase(ABC):
    """
    Base class for attention-like layers (Attention, Mamba, etc.) 
    that support the v1 engine.

    This provides a common interface for getting attention backends 
    from different layer types.
    """

    @abstractmethod
    def get_attn_backend(self) -> type["AttentionBackend"]:
        """Get the attention backend class for this layer."""
        pass

get_attn_backend abstractmethod

get_attn_backend() -> type[AttentionBackend]

Get the attention backend class for this layer.

Source code in vllm/model_executor/layers/attention_layer_base.py
@abstractmethod
def get_attn_backend(self) -> type["AttentionBackend"]:
    """Get the attention backend class for this layer."""
    pass