vllm.v1.sample.logits_processor.interface ¶
BatchUpdate dataclass ¶
Persistent batch state change info for logitsprocs
Source code in vllm/v1/sample/logits_processor/interface.py
LogitsProcessor ¶
Bases: ABC
Source code in vllm/v1/sample/logits_processor/interface.py
apply abstractmethod ¶
Apply LogitsProcessor to batch logits tensor.
The updated tensor must be returned but may be modified in-place.
is_argmax_invariant abstractmethod ¶
is_argmax_invariant() -> bool
True if logits processor has no impact on the argmax computation in greedy sampling. NOTE: may or may not have the same value for all instances of a given LogitsProcessor subclass, depending on subclass implementation.
Source code in vllm/v1/sample/logits_processor/interface.py
update_state abstractmethod ¶
update_state(batch_update: BatchUpdate | None) -> None
Called when there are new output tokens, prior to each forward pass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
batch_update | BatchUpdate | None | Non-None iff there have been changes to the batch makeup. | required |
Source code in vllm/v1/sample/logits_processor/interface.py
validate_params classmethod ¶
validate_params(sampling_params: SamplingParams)
Validate sampling params for this logits processor.
Raise ValueError for invalid ones.