From 7b261092de3b008f7a2c218e338f4f8a025c93ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atilla=20Akku=C5=9F?= Date: Wed, 7 Aug 2024 10:32:16 +0300 Subject: [PATCH] [BUGFIX]: top_k is expected to be an integer. (#7227) --- vllm/sampling_params.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vllm/sampling_params.py b/vllm/sampling_params.py index 25983254..1c1e5f16 100644 --- a/vllm/sampling_params.py +++ b/vllm/sampling_params.py @@ -224,6 +224,9 @@ class SamplingParams: if self.top_k < -1 or self.top_k == 0: raise ValueError(f"top_k must be -1 (disable), or at least 1, " f"got {self.top_k}.") + if not isinstance(self.top_k, int): + raise TypeError( + f"top_k must be an integer, got {type(self.top_k).__name__}") if not 0.0 <= self.min_p <= 1.0: raise ValueError("min_p must be in [0, 1], got " f"{self.min_p}.")