Skip to content

vllm.model_executor.layers.pooler.tokwise

Poolers that produce an output for each token in the sequence.

Modules:

Classes:

TokenEmbeddingPoolerHead

Bases: TokenPoolerHead

Methods:

  • forward_batched –

    Batch projection, splitting only when finishing needs per-request options.

_finish(embeddings, pooling_param)

Slice/normalize [num_rows, embedding_size] to [num_rows, output_size].

_project(hidden_states)

Project [num_rows, hidden_size] to [num_rows, embedding_size].

forward_batched(hidden_states, pooling_params, split)

Batch projection, splitting only when finishing needs per-request options.

Keep eligibility checks in sync with PoolingParams fields read by forward_chunk.

TokenPooler

Bases: Pooler

A layer that pools specific information from hidden states.

This layer does the following: 1. Extracts specific tokens or aggregates data based on pooling method. 2. Postprocesses the output based on pooling head. 3. Returns structured results as PoolerOutput.