Skip to content

vllm.model_executor.layers.attention.encoder_only_attention

Classes:

EncoderOnlyAttention

Bases: Attention

Encoder attention is a special case that doesn't need a KV Cache.

Methods:

  • __init__ –

    attn_backend replaces the selected backend (e.g. a model's own

__init__(num_heads, head_size, scale, cache_config=None, attn_type=None, attn_backend=None, **kwargs)

attn_backend replaces the selected backend (e.g. a model's own subclass); it is wrapped for non-causal metadata like the default. A given backend skips the backend selector and its validation, and overrides --attention-backend: checking that it supports the head size, dtype, KV cache dtype and platform is the caller's responsibility. A warning names the backend that is used. Its get_name() must be the name of a registered AttentionBackendEnum member.

Of the in-tree models, only the BERT classes (BertModel, BertPoolingModel and their layers) pass attn_backend through.