Skip to content

vllm.model_executor.models.bert

Classes:

BertEmbeddingModel

Bases: Module, SupportsQuant, SupportsLoRA

A model that uses Bert to provide embedding functionalities.

This class encapsulates the BertModel and provides an interface for embedding operations and customized pooling functions.

Attributes:

  • model –

    An instance of BertModel used for forward operations.

  • _pooler –

    An instance of Pooler used for pooling operations.

BertForMaskedLM

Bases: Module

Bert with a masked-language-modeling head on top of BertModel.

Produces per-token logits over the vocabulary. In vLLM terms this is a token-level pooling model (tok_pooling_type="ALL"): the encoder output is projected by the MLM head to vocab_size logits for every position, and the token pooler returns one vector per token.

BertForSequenceClassification

Bases: Module, SupportsCrossEncoding, SupportsQuant, SupportsLoRA

A model that uses Bert to provide embedding functionalities.

This class encapsulates the BertModel and provides an interface for embedding operations and customized pooling functions.

Attributes:

  • model –

    An instance of BertModel used for forward operations.

  • _pooler –

    An instance of Pooler used for pooling operations.

BertSpladeSparseEmbeddingModel

Bases: BertEmbeddingModel

BertEmbeddingModel + SPLADE sparse embedding. - Make logits by self.mlm_head - pooler: SPLADESparsePooler(mlm_head...)

SPLADESparsePooler

Bases: Pooler

SPLADE sparse pooling: logits = mlm_head(hidden_states) -> log1p(relu(logits)) -> (max|sum over L) -> [V]

Padding is masked with an attention mask, [CLS]/[SEP] is removed (selected), and then pooled.