Skip to content

Commit d054da1

Browse files
authored
[Misc] fix: add miss best_of param validation (#18555)
Signed-off-by: googs1025 <googs1025@gmail.com>
1 parent 4b7817c commit d054da1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

vllm/sampling_params.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,17 @@ def _verify_args(self) -> None:
389389
f"type {type(self.n)}")
390390
if self.n < 1:
391391
raise ValueError(f"n must be at least 1, got {self.n}.")
392+
if self.best_of is not None:
393+
if not isinstance(self.best_of, int):
394+
raise ValueError(
395+
f"best_of must be an integer, got {type(self.best_of)}")
396+
if self.best_of < 1:
397+
raise ValueError(
398+
f"best_of must be at least 1, got {self.best_of}")
399+
if self.best_of < self.n:
400+
raise ValueError(
401+
f"best_of must be greater than or equal to n, "
402+
f"got n={self.n} and best_of={self.best_of}.")
392403
if not -2.0 <= self.presence_penalty <= 2.0:
393404
raise ValueError("presence_penalty must be in [-2, 2], got "
394405
f"{self.presence_penalty}.")

0 commit comments

Comments
 (0)