From 762fd7c1aef86856f3508dcf9729dbfec4a8eead Mon Sep 17 00:00:00 2001 From: Marcel Date: Thu, 15 Jun 2023 22:00:37 +0200 Subject: [PATCH] Fixed a typo in FixedSizeQueue --- LLama/Common/{FixedQuene.cs => FixedSizeQueue.cs} | 8 ++++---- LLama/LLamaExecutorBase.cs | 4 ++-- LLama/LLamaInstructExecutor.cs | 2 +- LLama/LLamaInteractExecutor.cs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) rename LLama/Common/{FixedQuene.cs => FixedSizeQueue.cs} (89%) diff --git a/LLama/Common/FixedQuene.cs b/LLama/Common/FixedSizeQueue.cs similarity index 89% rename from LLama/Common/FixedQuene.cs rename to LLama/Common/FixedSizeQueue.cs index 4a56fc04..d74a670e 100644 --- a/LLama/Common/FixedQuene.cs +++ b/LLama/Common/FixedSizeQueue.cs @@ -10,14 +10,14 @@ namespace LLama.Common /// A queue with fixed storage size. /// Currently it's only a naive implementation and needs to be further optimized in the future. /// - public class FixedSizeQuene: IEnumerable + public class FixedSizeQueue: IEnumerable { int _maxSize; List _storage; public int Count => _storage.Count; public int Capacity => _maxSize; - public FixedSizeQuene(int size) + public FixedSizeQueue(int size) { _maxSize = size; _storage = new(); @@ -28,7 +28,7 @@ namespace LLama.Common /// /// /// - public FixedSizeQuene(int size, IEnumerable data) + public FixedSizeQueue(int size, IEnumerable data) { _maxSize = size; if(data.Count() > size) @@ -38,7 +38,7 @@ namespace LLama.Common _storage = new(data); } - public FixedSizeQuene FillWith(T value) + public FixedSizeQueue FillWith(T value) { for(int i = 0; i < Count; i++) { diff --git a/LLama/LLamaExecutorBase.cs b/LLama/LLamaExecutorBase.cs index 715f6b2d..98a8218f 100644 --- a/LLama/LLamaExecutorBase.cs +++ b/LLama/LLamaExecutorBase.cs @@ -24,7 +24,7 @@ namespace LLama protected List _embeds = new(); // embd protected List _embed_inps = new(); protected List _session_tokens = new(); - protected FixedSizeQuene _last_n_tokens; + protected FixedSizeQueue _last_n_tokens; public LLamaModel Model => _model; protected StatefulExecutorBase(LLamaModel model, ILLamaLogger? logger = null) { @@ -35,7 +35,7 @@ namespace LLama _n_session_consumed = 0; _embeds = new(); _embed_inps = new(); - _last_n_tokens = new FixedSizeQuene(_model.ContextSize).FillWith(0); + _last_n_tokens = new FixedSizeQueue(_model.ContextSize).FillWith(0); } public unsafe StatefulExecutorBase WithSessionFile(string filename) diff --git a/LLama/LLamaInstructExecutor.cs b/LLama/LLamaInstructExecutor.cs index b43ac7d1..3b575d2c 100644 --- a/LLama/LLamaInstructExecutor.cs +++ b/LLama/LLamaInstructExecutor.cs @@ -56,7 +56,7 @@ namespace LLama _is_prompt_run = state.IsPromptRun; _consumedTokensCount = state.ConsumedTokensCount; _embeds = state.Embeds; - _last_n_tokens = new FixedSizeQuene(state.LastTokensCapacity, state.LastTokens); + _last_n_tokens = new FixedSizeQueue(state.LastTokensCapacity, state.LastTokens); _inp_pfx = state.InputPrefixTokens; _inp_sfx = state.InputSuffixTokens; _n_matching_session_tokens = state.MatchingSessionTokensCount; diff --git a/LLama/LLamaInteractExecutor.cs b/LLama/LLamaInteractExecutor.cs index cdd0e47e..26beedc8 100644 --- a/LLama/LLamaInteractExecutor.cs +++ b/LLama/LLamaInteractExecutor.cs @@ -55,7 +55,7 @@ namespace LLama _is_prompt_run = state.IsPromptRun; _consumedTokensCount = state.ConsumedTokensCount; _embeds = state.Embeds; - _last_n_tokens = new FixedSizeQuene(state.LastTokensCapacity, state.LastTokens); + _last_n_tokens = new FixedSizeQueue(state.LastTokensCapacity, state.LastTokens); _llama_token_newline = state.LLamaNewlineTokens; _n_matching_session_tokens = state.MatchingSessionTokensCount; _pastTokensCount = state.PastTokensCount;