From d58fcbbd137ac7407a593587c3f5ffa4d38fe72a Mon Sep 17 00:00:00 2001 From: Martin Evans Date: Sun, 24 Sep 2023 14:26:43 +0100 Subject: [PATCH] Fixed antiprompt checking --- LLama/LLamaStatelessExecutor.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/LLama/LLamaStatelessExecutor.cs b/LLama/LLamaStatelessExecutor.cs index b09bd809..3ff755a0 100644 --- a/LLama/LLamaStatelessExecutor.cs +++ b/LLama/LLamaStatelessExecutor.cs @@ -104,15 +104,13 @@ namespace LLama inferenceParams.MirostatEta, inferenceParams.TopK, inferenceParams.TopP, inferenceParams.TfsZ, inferenceParams.TypicalP, inferenceParams.Grammar); lastTokens.Add(id); - - var response = Context.TokenToString(id); - yield return response; + yield return Context.TokenToString(id); tokens.Clear(); tokens.Add(id); // Check if any of the antiprompts have been generated - if (tokens.TokensEndsWithAnyString(antiprompts, Context)) + if (lastTokens.TokensEndsWithAnyString(antiprompts, Context)) break; // when run out of context