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
4cea74c7
Unverified
Commit
4cea74c7
authored
Nov 23, 2023
by
ljss
Committed by
GitHub
Nov 22, 2023
Browse files
Set top_p=0 and top_k=-1 in greedy sampling (#1748)
parent
a921d8be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
vllm/sampling_params.py
vllm/sampling_params.py
+2
-4
No files found.
vllm/sampling_params.py
View file @
4cea74c7
...
@@ -147,6 +147,8 @@ class SamplingParams:
...
@@ -147,6 +147,8 @@ class SamplingParams:
self
.
_verify_non_beam_search
()
self
.
_verify_non_beam_search
()
if
self
.
temperature
<
_SAMPLING_EPS
:
if
self
.
temperature
<
_SAMPLING_EPS
:
# Zero temperature means greedy sampling.
# Zero temperature means greedy sampling.
self
.
top_p
=
1.0
self
.
top_k
=
-
1
self
.
_verify_greedy_sampling
()
self
.
_verify_greedy_sampling
()
def
_verify_args
(
self
)
->
None
:
def
_verify_args
(
self
)
->
None
:
...
@@ -214,10 +216,6 @@ class SamplingParams:
...
@@ -214,10 +216,6 @@ class SamplingParams:
if
self
.
best_of
>
1
:
if
self
.
best_of
>
1
:
raise
ValueError
(
"best_of must be 1 when using greedy sampling."
raise
ValueError
(
"best_of must be 1 when using greedy sampling."
f
"Got
{
self
.
best_of
}
."
)
f
"Got
{
self
.
best_of
}
."
)
if
self
.
top_p
<
1.0
-
_SAMPLING_EPS
:
raise
ValueError
(
"top_p must be 1 when using greedy sampling."
)
if
self
.
top_k
!=
-
1
:
raise
ValueError
(
"top_k must be -1 when using greedy sampling."
)
@
cached_property
@
cached_property
def
sampling_type
(
self
)
->
SamplingType
:
def
sampling_type
(
self
)
->
SamplingType
:
...
...
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