@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / c0644cf9ce
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 16, 19:30 UTC

[Bugfix] fix logit processor excceed vocab size issue (#6927)

Fei committed Jul 31, 2024 at 01:16 UTC c0644cf9cef0002485749defcaa02e3fec359d49
1 file changed +6
vllm/entrypoints/openai/logits_processors.py
+6
@@ -58,6 +58,12 @@ def get_logits_processors(
58 "Found token_id in logit_bias that is not "
59 "an integer or string representing an integer") from exc
60
61 + # Check if token_id is within the vocab size
62 + for token_id, bias in clamped_logit_bias.items():
63 + if token_id < 0 or token_id >= tokenizer.vocab_size:
64 + raise ValueError("token_id in logit_bias contains "
65 + "out-of-vocab token id")
66 +
67 def logit_bias_logits_processor(token_ids: List[int],
68 logits: torch.Tensor) -> torch.Tensor:
69 for token_id, bias in clamped_logit_bias.items():