Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Fix logits processor when prompt_logprobs is not None #3899

Merged
merged 5 commits into from
Apr 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix logits_row_idx
huyiwen committed Apr 10, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 8292d89a512848c97576dd46d01dfeaa597fd1ea
12 changes: 7 additions & 5 deletions vllm/model_executor/layers/logits_processor.py
Original file line number Diff line number Diff line change
@@ -89,14 +89,16 @@ def _apply_logits_processors(
for i, seq_group in enumerate(sampling_metadata.seq_groups):
seq_ids, sampling_params = seq_group
logits_processors = sampling_params.logits_processors
# handle prompt_logprobs by skipping rows in logits added for
# the prompt tokens (prompt logprobs are not processed)
if (i < sampling_metadata.num_prompts
and sampling_params.prompt_logprobs is not None):
assert len(seq_ids) == 1
logits_row_idx += sampling_metadata.prompt_lens[i] - 1

if logits_processors:
found_logits_processors = True
for seq_id in seq_ids:
# handle prompt_logprobs by skipping rows in logits added for
# the prompt tokens (prompt logprobs are not processed)
if (i < sampling_metadata.num_prompts
and sampling_params.prompt_logprobs is not None):
logits_row_idx += sampling_metadata.prompt_lens[i] - 1
logits_row = logits[logits_row_idx]
token_ids = sampling_metadata.seq_data[seq_id].output_token_ids
for logits_processor in logits_processors: