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
a3223766
Unverified
Commit
a3223766
authored
Jul 22, 2025
by
Jialin Ouyang
Committed by
GitHub
Jul 22, 2025
Browse files
[Core] Optimize update checks in LogitsProcessor (#21245)
Signed-off-by:
Jialin Ouyang
<
Jialin.Ouyang@gmail.com
>
parent
bc8a8ce5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
vllm/v1/sample/logits_processor.py
vllm/v1/sample/logits_processor.py
+13
-5
No files found.
vllm/v1/sample/logits_processor.py
View file @
a3223766
...
...
@@ -335,14 +335,19 @@ class LogitBiasLogitsProcessor(LogitsProcessor):
if
not
batch_update
:
return
needs_update
:
bool
=
False
# Process added requests.
needs_update
=
bool
(
batch_update
.
added
)
for
index
,
params
,
_
in
batch_update
.
added
:
if
isinstance
(
params
,
SamplingParams
)
and
(
lb
:
=
params
.
logit_bias
):
self
.
biases
[
index
]
=
lb
needs_update
=
True
else
:
self
.
biases
.
pop
(
index
,
None
)
# Drop biases metadata at batch index
if
self
.
biases
.
pop
(
index
,
None
)
is
not
None
:
# If a new request replaces an old request which
# specified biases, we should update processor tensors
needs_update
=
True
if
self
.
biases
:
# Process removed requests.
...
...
@@ -419,7 +424,6 @@ class MinTokensLogitsProcessor(LogitsProcessor):
if
batch_update
:
# Process added requests.
needs_update
|=
bool
(
batch_update
.
added
)
for
index
,
params
,
output_tok_ids
in
batch_update
.
added
:
if
(
isinstance
(
params
,
SamplingParams
)
and
(
min_tokens
:
=
params
.
min_tokens
)
...
...
@@ -427,9 +431,13 @@ class MinTokensLogitsProcessor(LogitsProcessor):
# Replace request metadata at batch index
self
.
min_toks
[
index
]
=
(
min_tokens
,
output_tok_ids
,
params
.
all_stop_token_ids
)
needs_update
=
True
else
:
# Drop request metadata at batch index
self
.
min_toks
.
pop
(
index
,
None
)
# Drop min_toks metadata at batch index
if
self
.
min_toks
.
pop
(
index
,
None
)
is
not
None
:
# If a new request replaces an old request which
# specified min_toks, we should update processor tensors
needs_update
=
True
if
self
.
min_toks
:
# Process removed requests.
...
...
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