vllm.model_executor.layers.pooler ¶
   PoolingFn  module-attribute  ¶
    AllPool ¶
  Bases: PoolingMethod
Source code in vllm/model_executor/layers/pooler.py
   forward_all ¶
 forward_all(
    hidden_states: Tensor, pooling_cursor: PoolingCursor
) -> list[Tensor] | Tensor
Source code in vllm/model_executor/layers/pooler.py
   get_supported_tasks ¶
 get_supported_tasks() -> Set[PoolingTask]
  AllPooler ¶
  Bases: Pooler
Source code in vllm/model_executor/layers/pooler.py
   __init__ ¶
 __init__(head: Module | PoolerHead) -> None
  forward ¶
 forward(
    hidden_states: Tensor, pooling_metadata: PoolingMetadata
) -> PoolerOutput
Source code in vllm/model_executor/layers/pooler.py
   get_supported_tasks ¶
 get_supported_tasks() -> Set[PoolingTask]
  BasePoolerActivation ¶
 Source code in vllm/model_executor/layers/pooler.py
   forward  abstractmethod  ¶
  Source code in vllm/model_executor/layers/pooler.py
    CLSPool ¶
  Bases: PoolingMethod
Source code in vllm/model_executor/layers/pooler.py
   forward_all ¶
 forward_all(
    hidden_states: Tensor, pooling_cursor: PoolingCursor
) -> list[Tensor] | Tensor
Source code in vllm/model_executor/layers/pooler.py
   get_supported_tasks ¶
 get_supported_tasks() -> Set[PoolingTask]
  ClassifierPooler ¶
  Bases: Pooler
A pooling layer for classification tasks.
This layer does the following: 1. Applies a classification layer to the hidden states. 2. Optionally applies a pooler layer. 3. Applies an activation function to the output.
Source code in vllm/model_executor/layers/pooler.py
 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620  |  | 
  act_fn  instance-attribute  ¶
    __init__ ¶
 __init__(
    pooling: PoolingFn,
    classifier: ClassifierFn | None,
    act_fn: PoolerActivation | str | None = None,
) -> None
Source code in vllm/model_executor/layers/pooler.py
   act_fn_for_cross_encoder  staticmethod  ¶
 act_fn_for_cross_encoder(model_config: ModelConfig)
  act_fn_for_seq_cls  staticmethod  ¶
 act_fn_for_seq_cls(model_config: ModelConfig)
  forward ¶
 forward(
    hidden_states: Tensor | list[Tensor],
    pooling_metadata: PoolingMetadata,
) -> PoolerOutput
Source code in vllm/model_executor/layers/pooler.py
   get_supported_tasks ¶
 get_supported_tasks() -> Set[PoolingTask]
  resolve_act_fn  staticmethod  ¶
 resolve_act_fn(
    model_config: ModelConfig,
    static_num_labels: bool = True,
    act_fn: PoolerActivation | str | None = None,
)
Source code in vllm/model_executor/layers/pooler.py
   DispatchPooler ¶
  Bases: Pooler
Dispatches calls to a sub-pooler based on the pooling task.
Source code in vllm/model_executor/layers/pooler.py
   __init__ ¶
 __init__(
    poolers_by_task: Mapping[PoolingTask, Pooler],
) -> None
Source code in vllm/model_executor/layers/pooler.py
   forward ¶
 forward(
    hidden_states: Tensor | list[Tensor],
    pooling_metadata: PoolingMetadata,
) -> PoolerOutput
Source code in vllm/model_executor/layers/pooler.py
   get_pooling_updates ¶
 get_pooling_updates(
    task: PoolingTask,
) -> PoolingParamsUpdate
  get_supported_tasks ¶
 get_supported_tasks() -> Set[PoolingTask]
  DummyPooler ¶
  Bases: Pooler
Source code in vllm/model_executor/layers/pooler.py
    forward ¶
 forward(
    hidden_states: list[Tensor] | Tensor,
    pooling_metadata: PoolingMetadata,
) -> PoolerOutput
  get_supported_tasks ¶
 get_supported_tasks() -> Set[PoolingTask]
  EmbeddingPoolerHead ¶
  Bases: PoolerHead
Source code in vllm/model_executor/layers/pooler.py
   projector  instance-attribute  ¶
 projector: Module | None = (
    _load_st_projector(model_config)
    if vllm_config
    else None
)
  __init__ ¶
  Source code in vllm/model_executor/layers/pooler.py
   forward ¶
 forward(
    pooled_data: list[Tensor] | Tensor,
    pooling_metadata: PoolingMetadata,
)
Source code in vllm/model_executor/layers/pooler.py
   LambdaPoolerActivation ¶
    LastPool ¶
  Bases: PoolingMethod
Source code in vllm/model_executor/layers/pooler.py
   forward_all ¶
 forward_all(
    hidden_states: Tensor, pooling_cursor: PoolingCursor
) -> list[Tensor] | Tensor
  get_supported_tasks ¶
 get_supported_tasks() -> Set[PoolingTask]
  MeanPool ¶
  Bases: PoolingMethod
Source code in vllm/model_executor/layers/pooler.py
   forward_all ¶
 forward_all(
    hidden_states: Tensor, pooling_cursor: PoolingCursor
) -> list[Tensor] | Tensor
Source code in vllm/model_executor/layers/pooler.py
   get_supported_tasks ¶
 get_supported_tasks() -> Set[PoolingTask]
  Pooler ¶
 The interface required for all poolers used in pooling models in vLLM.
Source code in vllm/model_executor/layers/pooler.py
   for_classify  staticmethod  ¶
 for_classify(
    pooler_config: PoolerConfig,
    classifier: ClassifierFn | None,
    act_fn: PoolerActivation | str | None = None,
)
Source code in vllm/model_executor/layers/pooler.py
   for_embed  staticmethod  ¶
 for_embed(pooler_config: PoolerConfig)
Source code in vllm/model_executor/layers/pooler.py
   for_token_classify  staticmethod  ¶
 for_token_classify(
    pooler_config: PoolerConfig,
    classifier: ClassifierFn | None = None,
    act_fn: PoolerActivation | str | None = None,
)
Source code in vllm/model_executor/layers/pooler.py
   for_token_embed  staticmethod  ¶
 for_token_embed(pooler_config: PoolerConfig)
  forward  abstractmethod  ¶
 forward(
    hidden_states: list[Tensor] | Tensor,
    pooling_metadata: PoolingMetadata,
) -> PoolerOutput
  get_pooling_updates ¶
 get_pooling_updates(
    task: PoolingTask,
) -> PoolingParamsUpdate
Construct the updated pooling parameters to use for a supported task.
  get_supported_tasks  abstractmethod  ¶
 get_supported_tasks() -> Set[PoolingTask]
  PoolerActivation ¶
  Bases: BasePoolerActivation
Source code in vllm/model_executor/layers/pooler.py
   PoolerClassify ¶
  Bases: PoolerActivation
Source code in vllm/model_executor/layers/pooler.py
   __init__ ¶
 __init__(*, static_num_labels: bool = True) -> None
Source code in vllm/model_executor/layers/pooler.py
   forward_chunk ¶
  Source code in vllm/model_executor/layers/pooler.py
    PoolerHead ¶
  Bases: Module
Source code in vllm/model_executor/layers/pooler.py
   __init__ ¶
 __init__(activation: PoolerActivation) -> None
  forward ¶
 forward(
    pooled_data: list[Tensor] | Tensor,
    pooling_metadata: PoolingMetadata,
)
  PoolerIdentity ¶
  Bases: PoolerActivation
Source code in vllm/model_executor/layers/pooler.py
    PoolerMultiLabelClassify ¶
  Bases: PoolerActivation
Source code in vllm/model_executor/layers/pooler.py
    PoolerNormalize ¶
  Bases: PoolerActivation
Source code in vllm/model_executor/layers/pooler.py
    PoolingMethod ¶
 Source code in vllm/model_executor/layers/pooler.py
   forward ¶
 forward(
    hidden_states: Tensor, pooling_metadata: PoolingMetadata
) -> list[Tensor] | Tensor
Source code in vllm/model_executor/layers/pooler.py
    forward_all  abstractmethod  ¶
 forward_all(
    hidden_states: Tensor, pooling_cursor: PoolingCursor
) -> list[Tensor] | Tensor
  from_pooling_type  staticmethod  ¶
 from_pooling_type(
    pooling_type: PoolingType,
) -> PoolingMethod
Source code in vllm/model_executor/layers/pooler.py
   get_pooling_updates ¶
 get_pooling_updates(
    task: PoolingTask,
) -> PoolingParamsUpdate
  PoolingParamsUpdate  dataclass  ¶
 Source code in vllm/model_executor/layers/pooler.py
    requires_token_ids  class-attribute instance-attribute  ¶
 requires_token_ids: bool = False
Set this flag to enable get_prompt_token_ids for your pooler.
  apply ¶
 apply(params: PoolingParams) -> None
  PoolingType ¶
  Bases: IntEnum
Enumeration for different types of pooling methods.
Source code in vllm/model_executor/layers/pooler.py
    ResolvedPoolingConfig  dataclass  ¶
 Source code in vllm/model_executor/layers/pooler.py
   from_config  classmethod  ¶
 from_config(
    task: PoolingTask, pooler_config: PoolerConfig
) -> ResolvedPoolingConfig
Source code in vllm/model_executor/layers/pooler.py
    SimplePooler ¶
  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. Normalizes output if specified. 3. Returns structured results as PoolerOutput.
Source code in vllm/model_executor/layers/pooler.py
   __init__ ¶
 __init__(pooling: PoolingMethod, head: PoolerHead) -> None
  forward ¶
 forward(
    hidden_states: Tensor | list[Tensor],
    pooling_metadata: PoolingMetadata,
) -> PoolerOutput
Source code in vllm/model_executor/layers/pooler.py
    get_pooling_updates ¶
 get_pooling_updates(
    task: PoolingTask,
) -> PoolingParamsUpdate
  get_supported_tasks ¶
 get_supported_tasks() -> Set[PoolingTask]
  StepPooler ¶
  Bases: Pooler
Source code in vllm/model_executor/layers/pooler.py
   __init__ ¶
 __init__(head: Module | PoolerHead) -> None
  extract_states ¶
 extract_states(
    hidden_states: Tensor | list[Tensor],
    pooling_metadata: PoolingMetadata,
) -> Tensor | list[Tensor]
Source code in vllm/model_executor/layers/pooler.py
   forward ¶
 forward(
    hidden_states: Tensor | list[Tensor],
    pooling_metadata: PoolingMetadata,
) -> PoolerOutput
Source code in vllm/model_executor/layers/pooler.py
   get_pooling_updates ¶
 get_pooling_updates(
    task: PoolingTask,
) -> PoolingParamsUpdate
  get_supported_tasks ¶
 get_supported_tasks() -> Set[PoolingTask]
  TokenClassifierPoolerHead ¶
  Bases: Module
Source code in vllm/model_executor/layers/pooler.py
   act_fn  instance-attribute  ¶
 act_fn = resolve_act_fn(
    model_config, static_num_labels=False, act_fn=act_fn
)
  __init__ ¶
 __init__(
    classifier: ClassifierFn | None,
    act_fn: PoolerActivation | str | None = None,
) -> None
Source code in vllm/model_executor/layers/pooler.py
   forward ¶
 forward(
    hidden_states: Tensor, pooling_param: PoolingParams
) -> Tensor
Source code in vllm/model_executor/layers/pooler.py
   get_supported_tasks ¶
 get_supported_tasks() -> Set[PoolingTask]
  TokenEmbeddingPoolerHead ¶
  Bases: EmbeddingPoolerHead
Source code in vllm/model_executor/layers/pooler.py
   forward ¶
 forward(
    pooled_data: Tensor, pooling_param: PoolingParams
) -> Tensor
Source code in vllm/model_executor/layers/pooler.py
   get_classification_activation_function ¶
  Source code in vllm/model_executor/layers/pooler.py
   get_cross_encoder_activation_function ¶
  Source code in vllm/model_executor/layers/pooler.py
   get_pooling_params ¶
 get_pooling_params(
    pooling_metadata: PoolingMetadata,
) -> list[PoolingParams]
  get_prompt_lens ¶
 get_prompt_lens(
    hidden_states: Tensor | list[Tensor],
    pooling_metadata: PoolingMetadata,
) -> Tensor
  get_prompt_token_ids ¶
 get_prompt_token_ids(
    pooling_metadata: PoolingMetadata,
) -> list[Tensor]
Source code in vllm/model_executor/layers/pooler.py
   get_tasks ¶
 get_tasks(
    pooling_metadata: PoolingMetadata,
) -> list[PoolingTask]