vllm.model_executor.layers.utils ¶
Utility methods for model layers.
Functions:
-
apply_penalties–Applies penalties in place to the logits tensor
-
warmup_rocm_skinny_gemm_workspaces–Eagerly allocate wvSplitKrc's process-lifetime static workspaces.
apply_penalties(logits, prompt_tokens_tensor, output_tokens_tensor, presence_penalties, frequency_penalties, repetition_penalties) ¶
Applies penalties in place to the logits tensor logits : The input logits tensor of shape [num_seqs, vocab_size] prompt_tokens_tensor: A tensor containing the prompt tokens. The prompts are padded to the maximum prompt length within the batch using vocab_size as the padding value. The value vocab_size is used for padding because it does not correspond to any valid token ID in the vocabulary. output_tokens_tensor: The output tokens tensor. presence_penalties: The presence penalties of shape (num_seqs, ) frequency_penalties: The frequency penalties of shape (num_seqs, ) repetition_penalties: The repetition penalties of shape (num_seqs, )
Source code in vllm/model_executor/layers/utils.py
warmup_rocm_skinny_gemm_workspaces(device) cached ¶
Eagerly allocate wvSplitKrc's process-lifetime static workspaces.
They are otherwise created lazily on the first qualifying GEMM (csrc/rocm/skinny_gemms.cu), which can be the first real request — after the KV cache backing buffer exists. If one landed in that segment's rounding tail, it would pin the entire segment at engine shutdown.