From 069ed7c6efa92410aa48fc8973b3fa6d8e6fdf5d Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:05:41 -0800 Subject: [PATCH] Lint --- modules/llama_cpp_python_hijack.py | 8 ++++---- modules/presets.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/llama_cpp_python_hijack.py b/modules/llama_cpp_python_hijack.py index e63d9977..9bb38512 100644 --- a/modules/llama_cpp_python_hijack.py +++ b/modules/llama_cpp_python_hijack.py @@ -36,7 +36,7 @@ def eval_with_progress(self, tokens: Sequence[int]): progress_bar = range(0, len(tokens), self.n_batch) for i in progress_bar: - batch = tokens[i : min(len(tokens), i + self.n_batch)] + batch = tokens[i: min(len(tokens), i + self.n_batch)] n_past = self.n_tokens n_tokens = len(batch) self._batch.set_batch( @@ -44,16 +44,16 @@ def eval_with_progress(self, tokens: Sequence[int]): ) self._ctx.decode(self._batch) # Save tokens - self.input_ids[n_past : n_past + n_tokens] = batch + self.input_ids[n_past: n_past + n_tokens] = batch # Save logits rows = n_tokens cols = self._n_vocab offset = ( 0 if self.context_params.logits_all else n_tokens - 1 ) # NOTE: Only save the last token logits if logits_all is False - self.scores[n_past + offset : n_past + n_tokens, :].reshape(-1)[ + self.scores[n_past + offset: n_past + n_tokens, :].reshape(-1)[ : - ] = self._ctx.get_logits()[offset * cols : rows * cols] + ] = self._ctx.get_logits()[offset * cols: rows * cols] # Update n_tokens self.n_tokens += n_tokens diff --git a/modules/presets.py b/modules/presets.py index fe25ac5c..d4fcc7d0 100644 --- a/modules/presets.py +++ b/modules/presets.py @@ -125,7 +125,7 @@ def random_preset(state): for cat in params_and_values: choices = list(params_and_values[cat].keys()) if shared.args.loader is not None: - choices = [x for x in choices if loader_contains(sampler)] + choices = [x for x in choices if loader_contains(x)] if len(choices) > 0: choice = random.choice(choices)