diff --git a/vllm/sampling_params.py b/vllm/sampling_params.py index 76834e9bd7..23cdc33341 100644 --- a/vllm/sampling_params.py +++ b/vllm/sampling_params.py @@ -535,6 +535,12 @@ class SamplingParams( "stop strings are only supported when detokenize is True. " "Set detokenize=True to use stop." ) + assert isinstance(self.bad_words, list) + if any(not bad_word for bad_word in self.bad_words): + raise ValueError( + f"bad_words cannot contain an empty string. " + f"Got bad_words={self.bad_words}" + ) def _verify_greedy_sampling(self) -> None: if self.n > 1: