Unverified Commit 4059adc3 authored by Nick Hill's avatar Nick Hill Committed by GitHub
Browse files

[Misc][Minor] Simplify `SamplingParams.__post_init__()` (#14772)


Signed-off-by: default avatarNick Hill <nhill@redhat.com>
parent f1f632d9
...@@ -338,29 +338,23 @@ class SamplingParams( ...@@ -338,29 +338,23 @@ class SamplingParams(
if self.seed == -1: if self.seed == -1:
self.seed = None self.seed = None
else:
self.seed = self.seed
if self.stop is None: if self.stop is None:
self.stop = [] self.stop = []
elif isinstance(self.stop, str): elif isinstance(self.stop, str):
self.stop = [self.stop] self.stop = [self.stop]
else:
self.stop = list(self.stop)
if self.stop_token_ids is None: if self.stop_token_ids is None:
self.stop_token_ids = [] self.stop_token_ids = []
else:
self.stop_token_ids = list(self.stop_token_ids)
if self.bad_words is None: if self.bad_words is None:
self.bad_words = [] self.bad_words = []
else:
self.bad_words = list(self.bad_words)
self.logprobs = 1 if self.logprobs is True else self.logprobs if self.logprobs is True:
self.prompt_logprobs = (1 if self.prompt_logprobs is True else self.logprobs = 1
self.prompt_logprobs)
if self.prompt_logprobs is True:
self.prompt_logprobs = 1
# Number of characters to hold back for stop string evaluation # Number of characters to hold back for stop string evaluation
# until sequence is finished. # until sequence is finished.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment