Skip to content

Commit

Permalink
Update vllm/v1/sample/sampler.py
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Hill <[email protected]>
  • Loading branch information
afeldman-nm and njhill authored Jan 22, 2025
1 parent 832d5c8 commit a49ab7e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions vllm/v1/sample/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,8 @@ def get_logprobs(
topk_indices = topk_indices.to(torch.int32)

# Concatenate with the token_ids
sampled_logprobs = logprobs[torch.arange(logprobs.size(0)),
token_ids].unsqueeze(-1)
token_ids = token_ids.unsqueeze(-1)
sampled_logprobs = logprobs.gather(-1, token_ids)
topk_indices = torch.cat([token_ids, topk_indices], dim=1)
topk_logprobs = torch.cat([sampled_logprobs, topk_logprobs], dim=1)

Expand Down

0 comments on commit a49ab7e

Please sign in to comment.