diff --git a/LLama/LLamaStatelessExecutor.cs b/LLama/LLamaStatelessExecutor.cs index 77c9dbe4f..e03fe7a1c 100644 --- a/LLama/LLamaStatelessExecutor.cs +++ b/LLama/LLamaStatelessExecutor.cs @@ -106,6 +106,10 @@ public async IAsyncEnumerable InferAsync(string prompt, IInferenceParams ); } + // Check if this is the EOS token + if (id == _weights.EndOfSentenceToken) + break; + // Decode this token into text decoder.Add(id); var decoded = decoder.Read();