[Refactor] Worker/ModelRunner runner correctness fixes (G2/N) (#5452)
Signed-off-by: tzhouam <tzhouam@connect.ust.hk> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
48e4f6a385
commit
10906e3a6d
13 files changed
+1412
-179
No files matched your search
@@ -8,7 +8,21 @@ from vllm.v1.sample.logits_processor import LogitsProcessors, MinTokensLogitsPro
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
__all__ = ["sanitize_min_tokens_stop_ids"]
|
||||
__all__ = ["clamp_prompt_ids_to_penalty_padding", "sanitize_min_tokens_stop_ids"]
|
||||
|
||||
|
||||
def clamp_prompt_ids_to_penalty_padding(prompt_token_ids: torch.Tensor, logits_vocab: int) -> torch.Tensor:
|
||||
"""Clamp batch-level pad ids down to ``logits_vocab`` — upstream's
|
||||
designed penalty padding value.
|
||||
|
||||
``max=logits_vocab`` (NOT ``logits_vocab - 1``) is deliberate: upstream
|
||||
penalty computation allocates ``vocab_size + 1`` bins and drops the last
|
||||
column, so ``vocab_size`` is the padding value that never affects
|
||||
penalties (vllm/model_executor/layers/utils.py::
|
||||
get_token_bin_counts_and_mask). Clamping one lower would count padding
|
||||
as real occurrences of the last vocab token.
|
||||
"""
|
||||
return prompt_token_ids.clamp(max=logits_vocab)
|
||||
|
||||
|
||||
def sanitize_min_tokens_stop_ids(logitsprocs: LogitsProcessors, logits_vocab: int) -> None:
|
||||
|
||||
Reference in new issue
Block a user