Skip to content

Commit 8262a3e

Browse files
authored
[Misc] Validate stop_token_ids contents (#17268)
Signed-off-by: Nick Hill <[email protected]>
1 parent f211331 commit 8262a3e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

vllm/sampling_params.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,10 @@ def _verify_args(self) -> None:
437437
and self.truncate_prompt_tokens < 1):
438438
raise ValueError(f"truncate_prompt_tokens must be >= 1, "
439439
f"got {self.truncate_prompt_tokens}")
440+
assert isinstance(self.stop_token_ids, list)
441+
if not all(isinstance(st_id, int) for st_id in self.stop_token_ids):
442+
raise ValueError(f"stop_token_ids must contain only integers, "
443+
f"got {self.stop_token_ids}.")
440444
assert isinstance(self.stop, list)
441445
if any(not stop_str for stop_str in self.stop):
442446
raise ValueError("stop cannot contain an empty string.")

0 commit comments

Comments
 (0)