From b4a3db3e546df5ac030465b3b75d3b190548b1ed Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Mon, 26 Jun 2023 08:50:30 -0400 Subject: [PATCH] Update type signature --- llama_cpp/llama.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llama_cpp/llama.py b/llama_cpp/llama.py index d367601..3465cd4 100644 --- a/llama_cpp/llama.py +++ b/llama_cpp/llama.py @@ -325,7 +325,7 @@ class Llama: self._token_eos = Llama.token_eos() self._input_ids = np.array([], dtype=np.intc) - self._scores = np.ndarray((0, self._n_vocab), dtype=np.single) + self._scores: npt.NDArray[np.single] = np.ndarray((0, self._n_vocab), dtype=np.single) def tokenize(self, text: bytes, add_bos: bool = True) -> List[int]: """Tokenize a string. @@ -405,7 +405,7 @@ class Llama: """ assert self.ctx is not None n_ctx = self._n_ctx - scores = [] + scores: List[npt.NDArray[np.single]] = [] for i in range(0, len(tokens), self.n_batch): batch = tokens[i : min(len(tokens), i + self.n_batch)] n_past = min(n_ctx - len(batch), len(self._input_ids))