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

Fixes the error in num_accepted_tokens calculation in reject sampler #2658

Closed
Closed
Changes from all commits
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
5 changes: 3 additions & 2 deletions vllm/model_executor/layers/rejection_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,9 @@ def _create_output(
output.mul_(~after_false_mask).add_(
recovered_token_ids.mul(after_false_mask))

self.num_accepted_tokens += accepted.sum()
self.num_emitted_tokens += (output_with_bonus_tokens != -1).sum()
num_emitted_tokens = (output_with_bonus_tokens != -1).sum()
self.num_emitted_tokens += num_emitted_tokens
self.num_accepted_tokens += num_emitted_tokens - batch_size
self.num_draft_tokens += batch_size * k

return output_with_bonus_tokens
Expand Down
Loading