Skip to content

Commit 94d2f59

Browse files
authored
Set replacement=True in torch.multinomial (#858)
1 parent 75c0ca9 commit 94d2f59

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

vllm/model_executor/layers/sampler.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,9 @@ def _sample_from_prompt(
302302
# Random sampling.
303303
# Sample `best_of` tokens for the prompt.
304304
num_seqs = sampling_params.best_of
305-
next_token_ids = torch.multinomial(prob, num_samples=num_seqs)
305+
next_token_ids = torch.multinomial(prob,
306+
num_samples=num_seqs,
307+
replacement=True)
306308
next_token_ids = next_token_ids.tolist()
307309
return next_token_ids
308310

0 commit comments

Comments
 (0)