vllm.v1.sample.logits_processor.interface ¶
Classes:
-
BatchUpdate–Persistent batch state change info for logitsprocs
-
LogitsProcessor–
BatchUpdate dataclass ¶
Persistent batch state change info for logitsprocs
Source code in vllm/v1/sample/logits_processor/interface.py
LogitsProcessor ¶
Bases: ABC
Methods:
-
apply–Apply LogitsProcessor to batch logits tensor.
-
is_argmax_invariant–True if logits processor has no impact on the
-
update_state–Called when there are new output tokens, prior
-
validate_params–Validate sampling params for this logits processor.
Source code in vllm/v1/sample/logits_processor/interface.py
apply(logits) abstractmethod ¶
Apply LogitsProcessor to batch logits tensor.
The updated tensor must be returned but may be modified in-place.
is_argmax_invariant() abstractmethod ¶
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(batch_update) abstractmethod ¶
Called when there are new output tokens, prior to each forward pass.
Parameters:
-
(batch_update¶BatchUpdate | None) –Non-None iff there have been changes to the batch makeup.
Source code in vllm/v1/sample/logits_processor/interface.py
validate_params(sampling_params) classmethod ¶
Validate sampling params for this logits processor.
Raise ValueError for invalid ones.