Skip to content

Commit

Permalink
Set replacement=True in torch.multinomial (vllm-project#858)
Browse files Browse the repository at this point in the history
  • Loading branch information
WoosukKwon authored Aug 25, 2023
1 parent c1315b9 commit a6999e1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vllm/model_executor/layers/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,9 @@ def _sample_from_prompt(
# Random sampling.
# Sample `best_of` tokens for the prompt.
num_seqs = sampling_params.best_of
next_token_ids = torch.multinomial(prob, num_samples=num_seqs)
next_token_ids = torch.multinomial(prob,
num_samples=num_seqs,
replacement=True)
next_token_ids = next_token_ids.tolist()
return next_token_ids

Expand Down

0 comments on commit a6999e1

Please sign in to comment.