vllm.logits_process ¶
   LogitsProcessor  module-attribute  ¶
 LogitsProcessor: TypeAlias = (
    Callable[[list[int], Tensor], Tensor]
    | Callable[[list[int], list[int], Tensor], Tensor]
)
LogitsProcessor is a function that takes a list of previously generated tokens, the logits tensor for the next token and, optionally, prompt tokens as a first argument, and returns a modified tensor of logits to sample from.
  NoBadWordsLogitsProcessor ¶
 Source code in vllm/logits_process.py
   __call__ ¶
  Source code in vllm/logits_process.py
   __init__ ¶
     _check_token_ids_bounds ¶
 _check_token_ids_bounds(vocab_size: int) -> None
Source code in vllm/logits_process.py
   _init_word_bias ¶
  Source code in vllm/logits_process.py
   get_bad_words_logits_processors ¶
 get_bad_words_logits_processors(
    bad_words: list[str], tokenizer: AnyTokenizer
) -> list[LogitsProcessor]