vllm.model_executor.layers.pooler.tokwise
¶
Poolers that produce an output for each token in the sequence.
Modules:
Classes:
-
TokenEmbeddingPoolerHead– -
TokenPooler–A layer that pools specific information from hidden states.
TokenEmbeddingPoolerHead
¶
Bases: TokenPoolerHead
Methods:
-
forward_batched–Batch projection, splitting only when finishing needs per-request options.
Source code in vllm/model_executor/layers/pooler/tokwise/heads.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
_finish(embeddings, pooling_param)
¶
Slice/normalize [num_rows, embedding_size] to [num_rows, output_size].
Source code in vllm/model_executor/layers/pooler/tokwise/heads.py
_project(hidden_states)
¶
Project [num_rows, hidden_size] to [num_rows, embedding_size].
Source code in vllm/model_executor/layers/pooler/tokwise/heads.py
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.
Source code in vllm/model_executor/layers/pooler/tokwise/heads.py
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.