Skip to content

Commit 4b3d449

Browse files
njhilllk-chen
authored andcommitted
[Misc] Validate stop_token_ids contents (vllm-project#17268)
Signed-off-by: Nick Hill <nhill@redhat.com>
1 parent 3241ed5 commit 4b3d449

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

vllm/sampling_params.py

+4
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)