mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-10 03:35:17 +08:00
[Bugfix] fix logit processor excceed vocab size issue (#6927)
This commit is contained in:
parent
533d1932d2
commit
c0644cf9ce
@ -58,6 +58,12 @@ def get_logits_processors(
|
||||
"Found token_id in logit_bias that is not "
|
||||
"an integer or string representing an integer") from exc
|
||||
|
||||
# Check if token_id is within the vocab size
|
||||
for token_id, bias in clamped_logit_bias.items():
|
||||
if token_id < 0 or token_id >= tokenizer.vocab_size:
|
||||
raise ValueError("token_id in logit_bias contains "
|
||||
"out-of-vocab token id")
|
||||
|
||||
def logit_bias_logits_processor(token_ids: List[int],
|
||||
logits: torch.Tensor) -> torch.Tensor:
|
||||
for token_id, bias in clamped_logit_bias.items():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user