A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 15, 19:45 UTC
[Misc][Minor] Simplify `SamplingParams.__post_init__()` (#14772)
Signed-off-by: Nick Hill <nhill@redhat.com>
Nick Hill committed
Mar 13, 2025 at 23:44 UTC
4059adc31b7a58f3b14c34d8bdb2805191d8a067
1 file changed
+5
-11
vllm/sampling_params.py
+5
-11
@@ -338,29 +338,23 @@ class SamplingParams(
338
339
if self.seed == -1:
340
self.seed = None
341
- else:
342
- self.seed = self.seed
341
342
if self.stop is None:
343
self.stop = []
344
elif isinstance(self.stop, str):
345
self.stop = [self.stop]
348
- else:
349
- self.stop = list(self.stop)
346
347
if self.stop_token_ids is None:
348
self.stop_token_ids = []
353
- else:
354
- self.stop_token_ids = list(self.stop_token_ids)
349
350
if self.bad_words is None:
351
self.bad_words = []
358
- else:
359
- self.bad_words = list(self.bad_words)
352
361
- self.logprobs = 1 if self.logprobs is True else self.logprobs
362
- self.prompt_logprobs = (1 if self.prompt_logprobs is True else
363
- self.prompt_logprobs)
353
+ if self.logprobs is True:
354
+ self.logprobs = 1
355
+
356
+ if self.prompt_logprobs is True:
357
+ self.prompt_logprobs = 1
358
359
# Number of characters to hold back for stop string evaluation
360
# until sequence is finished.