Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
c0644cf9
Unverified
Commit
c0644cf9
authored
Jul 31, 2024
by
Fei
Committed by
GitHub
Jul 31, 2024
Browse files
[Bugfix] fix logit processor excceed vocab size issue (#6927)
parent
533d1932
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
vllm/entrypoints/openai/logits_processors.py
vllm/entrypoints/openai/logits_processors.py
+6
-0
No files found.
vllm/entrypoints/openai/logits_processors.py
View file @
c0644cf9
...
@@ -58,6 +58,12 @@ def get_logits_processors(
...
@@ -58,6 +58,12 @@ def get_logits_processors(
"Found token_id in logit_bias that is not "
"Found token_id in logit_bias that is not "
"an integer or string representing an integer"
)
from
exc
"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
],
def
logit_bias_logits_processor
(
token_ids
:
List
[
int
],
logits
:
torch
.
Tensor
)
->
torch
.
Tensor
:
logits
:
torch
.
Tensor
)
->
torch
.
Tensor
:
for
token_id
,
bias
in
clamped_logit_bias
.
items
():
for
token_id
,
bias
in
clamped_logit_bias
.
items
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment