Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
norm
vllm
Commits
94d2f598
Unverified
Commit
94d2f598
authored
Aug 25, 2023
by
Woosuk Kwon
Committed by
GitHub
Aug 25, 2023
Browse files
Set replacement=True in torch.multinomial (#858)
parent
75c0ca9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
vllm/model_executor/layers/sampler.py
vllm/model_executor/layers/sampler.py
+3
-1
No files found.
vllm/model_executor/layers/sampler.py
View file @
94d2f598
...
@@ -302,7 +302,9 @@ def _sample_from_prompt(
...
@@ -302,7 +302,9 @@ def _sample_from_prompt(
# Random sampling.
# Random sampling.
# Sample `best_of` tokens for the prompt.
# Sample `best_of` tokens for the prompt.
num_seqs
=
sampling_params
.
best_of
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
()
next_token_ids
=
next_token_ids
.
tolist
()
return
next_token_ids
return
next_token_ids
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment