Skip to content

Commit c05fcdf

Browse files
Fixed none value of logits processors.
1 parent 5bb780d commit c05fcdf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llama_cpp/llama.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,10 @@ def _sample(
320320
):
321321
assert self.ctx is not None
322322
assert len(self.eval_logits) > 0
323+
324+
if logits_processors == None:
325+
logits_processors = []
326+
323327
n_vocab = self.n_vocab()
324328
n_ctx = self.n_ctx()
325329
top_k = llama_cpp.c_int(n_vocab) if top_k.value <= 0 else top_k
@@ -652,6 +656,10 @@ def _create_completion(
652656
stopping_criterias=None
653657
) -> Union[Iterator[Completion], Iterator[CompletionChunk]]:
654658
assert self.ctx is not None
659+
660+
if stopping_criterias == None:
661+
stopping_criterias = []
662+
655663
completion_id: str = f"cmpl-{str(uuid.uuid4())}"
656664
created: int = int(time.time())
657665
completion_tokens: List[int] = []

0 commit comments

Comments
 (0)