vllm.model_executor.models.interfaces_base Âķ
Classes:
-
VllmModelâThe interface required for all models in vLLM.
-
VllmModelForPoolingâThe interface required for all pooling models in vLLM.
-
VllmModelForTextGenerationâThe interface required for all generative models in vLLM.
Functions:
-
attn_typeâDecorator to set
VllmModelForPooling.attn_type. -
default_pooling_typeâDecorator to set
VllmModelForPooling.default_*_pooling_type.
VllmModel Âķ
Bases: Protocol[T_co]
The interface required for all models in vLLM.
Methods:
-
embed_input_idsâApply token embeddings to
input_ids.
Source code in vllm/model_executor/models/interfaces_base.py
VllmModelForPooling Âķ
Bases: VllmModel[T_co], Protocol[T_co]
The interface required for all pooling models in vLLM.
Attributes:
-
attn_type(AttnTypeStr) âIndicates the
-
default_seq_pooling_type(SequencePoolingType) âIndicates the vllm.config.pooler.PoolerConfig.seq_pooling_type
-
default_tok_pooling_type(TokenPoolingType) âIndicates the vllm.config.pooler.PoolerConfig.tok_pooling_type
-
is_pooling_model(Literal[True]) âA flag that indicates this model supports pooling.
-
pooler(Pooler) âThe pooler is only called on TP rank 0.
-
score_type(ScoreType) âIndicates the
Source code in vllm/model_executor/models/interfaces_base.py
attn_type = 'decoder' class-attribute Âķ
Indicates the vllm.config.model.ModelConfig.attn_type to use by default.
You can use the vllm.model_executor.models.interfaces_base.attn_type decorator to conveniently set this field.
default_seq_pooling_type = 'LAST' class-attribute Âķ
Indicates the vllm.config.pooler.PoolerConfig.seq_pooling_type to use by default.
You can use the vllm.model_executor.models.interfaces_base.default_pooling_type decorator to conveniently set this field.
default_tok_pooling_type = 'ALL' class-attribute Âķ
Indicates the vllm.config.pooler.PoolerConfig.tok_pooling_type to use by default.
You can use the vllm.model_executor.models.interfaces_base.default_pooling_type decorator to conveniently set this field.
is_pooling_model = True class-attribute Âķ
A flag that indicates this model supports pooling.
Note
There is no need to redefine this flag if this class is in the MRO of your model class.
pooler instance-attribute Âķ
The pooler is only called on TP rank 0.
score_type = 'bi-encoder' class-attribute Âķ
Indicates the vllm.config.model.ModelConfig.score_type to use by default.
Scoring API handles score/rerank for:
-
"classify" task (score_type: cross-encoder models)
-
"embed" task (score_type: bi-encoder models)
-
"token_embed" task (score_type: late interaction models)
score_type defaults to bi-encoder, then the Score API uses the "embed" task.
If you set score_type to cross-encoder via vllm.model_executor.models.interfaces.SupportsCrossEncoding, then the Score API uses the "score" task.
If you set score_type to late-interaction via vllm.model_executor.models.interfaces.SupportsLateInteraction, then the Score API uses the "token_embed" task.
VllmModelForTextGeneration Âķ
Bases: VllmModel[T], Protocol[T]
The interface required for all generative models in vLLM.
Methods:
-
compute_logitsâReturn
Noneif TP rank > 0.
Source code in vllm/model_executor/models/interfaces_base.py
attn_type(attn_type) Âķ
Decorator to set VllmModelForPooling.attn_type.
default_pooling_type(*, seq_pooling_type='LAST', tok_pooling_type='ALL') Âķ
Decorator to set VllmModelForPooling.default_*_pooling_type.