Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
480b7f40
Unverified
Commit
480b7f40
authored
Oct 08, 2024
by
Travis Johnson
Committed by
GitHub
Oct 09, 2024
Browse files
[Misc] Improve validation errors around best_of and n (#9167)
Signed-off-by:
Travis Johnson
<
tsjohnso@us.ibm.com
>
parent
acce7630
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
vllm/sampling_params.py
vllm/sampling_params.py
+7
-4
No files found.
vllm/sampling_params.py
View file @
480b7f40
...
@@ -330,8 +330,8 @@ class SamplingParams(
...
@@ -330,8 +330,8 @@ class SamplingParams(
if
self
.
n
<
1
:
if
self
.
n
<
1
:
raise
ValueError
(
f
"n must be at least 1, got
{
self
.
n
}
."
)
raise
ValueError
(
f
"n must be at least 1, got
{
self
.
n
}
."
)
if
not
isinstance
(
self
.
best_of
,
int
):
if
not
isinstance
(
self
.
best_of
,
int
):
raise
ValueError
(
f
'
best_of must be an int, but is of
'
raise
ValueError
(
f
"
best_of must be an int, but is of
"
f
'
type
{
type
(
self
.
best_of
)
}
'
)
f
"
type
{
type
(
self
.
best_of
)
}
"
)
if
self
.
best_of
<
self
.
n
:
if
self
.
best_of
<
self
.
n
:
raise
ValueError
(
f
"best_of must be greater than or equal to n, "
raise
ValueError
(
f
"best_of must be greater than or equal to n, "
f
"got n=
{
self
.
n
}
and best_of=
{
self
.
best_of
}
."
)
f
"got n=
{
self
.
n
}
and best_of=
{
self
.
best_of
}
."
)
...
@@ -390,10 +390,13 @@ class SamplingParams(
...
@@ -390,10 +390,13 @@ class SamplingParams(
raise
ValueError
(
"best_of must equal n to use output_kind=DELTA"
)
raise
ValueError
(
"best_of must equal n to use output_kind=DELTA"
)
def
_verify_greedy_sampling
(
self
)
->
None
:
def
_verify_greedy_sampling
(
self
)
->
None
:
if
self
.
n
>
1
:
raise
ValueError
(
"n must be 1 when using greedy sampling, "
f
"got
{
self
.
n
}
."
)
assert
isinstance
(
self
.
best_of
,
int
)
assert
isinstance
(
self
.
best_of
,
int
)
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
"
G
ot
{
self
.
best_of
}
."
)
f
"
g
ot
{
self
.
best_of
}
."
)
def
update_from_generation_config
(
def
update_from_generation_config
(
self
,
self
,
...
...
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