From 5afe6c2f38e24c1623fcac0e0742217f4d8ef1c6 Mon Sep 17 00:00:00 2001 From: vegetableysm Date: Mon, 26 Feb 2024 11:51:37 +0800 Subject: [PATCH] Minor:fix spelling error. Signed-off-by: vegetableysm --- modules/kv-state-cache/ds/kv_state_cache.cc | 6 +++--- modules/kv-state-cache/ds/kv_state_cache.h | 4 ++-- modules/kv-state-cache/ds/kv_state_cache_block.cc | 2 +- modules/kv-state-cache/ds/kv_state_cache_block.h | 2 +- test/kv_state_cache_test.cc | 12 ++++++------ test/kv_state_cache_test_2.cc | 12 ++++++------ 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/modules/kv-state-cache/ds/kv_state_cache.cc b/modules/kv-state-cache/ds/kv_state_cache.cc index c87c300b0..dbbfd4c39 100644 --- a/modules/kv-state-cache/ds/kv_state_cache.cc +++ b/modules/kv-state-cache/ds/kv_state_cache.cc @@ -96,7 +96,7 @@ KVStateCacheBuilder::KVStateCacheBuilder(Client& client, int dimension, KVStateCacheBuilder::KVStateCacheBuilder(Client& client, std::shared_ptr cache) { // TBD - this->dimension = cache->GetDemension(); + this->dimension = cache->GetDimension(); this->version = cache->GetVersion(); this->layer = cache->GetLayer(); // 1. create block builder from block @@ -185,11 +185,11 @@ void KVStateCacheBuilder::Update(Client& client, LOG(INFO) << "kvStateCacheBlockBuilder:" << kvStateCacheBlockBuilder; if (kvStateCacheBlockBuilder->IsFull()) { /** - * If the kv-state cache of the tree is full, triggle split. Delete the + * If the kv-state cache of the tree is full, trigger split. Delete the * empty node from the radix tree and split the tree. Then, kv-state cache * split according to the new tree. */ - LOG(INFO) << "triggle splits"; + LOG(INFO) << "trigger splits"; std::shared_ptr evictedNodeData = nullptr; this->rootTree->Delete(tokenListCopy, evictedNodeData); diff --git a/modules/kv-state-cache/ds/kv_state_cache.h b/modules/kv-state-cache/ds/kv_state_cache.h index 2706e1374..f378aef34 100644 --- a/modules/kv-state-cache/ds/kv_state_cache.h +++ b/modules/kv-state-cache/ds/kv_state_cache.h @@ -61,7 +61,7 @@ class KVStateCache : public vineyard::Registered { return this->kvStateCacheBlockList; } - int GetDemension() { return this->dimension; } + int GetDimension() { return this->dimension; } int GetCacheCapacity() { return this->cacheCapacity; } @@ -110,7 +110,7 @@ class KVStateCacheBuilder : public vineyard::ObjectBuilder { std::shared_ptr _Seal(Client& client) override; - uint64_t GetDemension() { return this->dimension; } + uint64_t GetDimension() { return this->dimension; } std::shared_ptr GetRootTree() { return this->rootTree; } diff --git a/modules/kv-state-cache/ds/kv_state_cache_block.cc b/modules/kv-state-cache/ds/kv_state_cache_block.cc index 2a90f9508..397e3b042 100644 --- a/modules/kv-state-cache/ds/kv_state_cache_block.cc +++ b/modules/kv-state-cache/ds/kv_state_cache_block.cc @@ -181,7 +181,7 @@ void KVStateCacheBlockBuilder::Update(const KV_STATE_WITH_LAYER& kvState, std::vector valueStateVector = (kvState.find(currentLayer)->second).second; LOG(INFO) << "vector size:" << keyStateVector.size() << " " - << valueStateVector.size() << " demension" << this->dimension; + << valueStateVector.size() << " dimension" << this->dimension; VINEYARD_ASSERT(keyStateVector.size() == (size_t) this->dimension); VINEYARD_ASSERT(valueStateVector.size() == (size_t) this->dimension); diff --git a/modules/kv-state-cache/ds/kv_state_cache_block.h b/modules/kv-state-cache/ds/kv_state_cache_block.h index b11ec35ba..3bb20d3af 100644 --- a/modules/kv-state-cache/ds/kv_state_cache_block.h +++ b/modules/kv-state-cache/ds/kv_state_cache_block.h @@ -53,7 +53,7 @@ namespace vineyard { /** * @brief KVStateCacheBlock is a cache for kv-cache of LLM. When a new prompt * comes, LLM can query KVStateCacheBlock to get the state of the kv-cache to - * avoid caclulating the kv-cache again if the new prompt is similar to the + * avoid calculate the kv-cache again if the new prompt is similar to the * previous one. * * KVStateCacheBlock is stored in vineyard as a vineyard object which contains a diff --git a/test/kv_state_cache_test.cc b/test/kv_state_cache_test.cc index 34db46eb6..fa59f48b4 100644 --- a/test/kv_state_cache_test.cc +++ b/test/kv_state_cache_test.cc @@ -24,12 +24,12 @@ limitations under the License. using namespace vineyard; -#define DEMENSION 10 +#define DIMENSION 10 #define CAPACITY 20 #define LAYER 3 #define BLOCK_SIZE 5 -void init() { InitKVStateCache(DEMENSION, CAPACITY, LAYER, BLOCK_SIZE); } +void init() { InitKVStateCache(DIMENSION, CAPACITY, LAYER, BLOCK_SIZE); } void print_current_tokens(const std::vector& prefix, int next_token) { std::string tokens_str = ""; @@ -47,7 +47,7 @@ void print_kv_state( for (auto iter = kv_state.begin(); iter != kv_state.end(); ++iter) { std::string key_state_str = ""; std::string value_state_str = ""; - for (int i = 0; i < DEMENSION; ++i) { + for (int i = 0; i < DIMENSION; ++i) { key_state_str += std::to_string(iter->second.first[i]) + " "; value_state_str += std::to_string(iter->second.second[i]) + " "; } @@ -65,10 +65,10 @@ generate_kv_state(int token) { for (int currentLayer = 0; currentLayer < LAYER; currentLayer++) { std::vector key_state; std::vector value_state; - for (int i = 0; i < DEMENSION; ++i) { - key_state.push_back(((double) token) / DEMENSION * (i + 1) + + for (int i = 0; i < DIMENSION; ++i) { + key_state.push_back(((double) token) / DIMENSION * (i + 1) + currentLayer * 10); - value_state.push_back(((double) token) / DEMENSION * (i + 1) * 2 + + value_state.push_back(((double) token) / DIMENSION * (i + 1) * 2 + currentLayer * 10); } diff --git a/test/kv_state_cache_test_2.cc b/test/kv_state_cache_test_2.cc index 4bc29157b..db7ab2ed5 100644 --- a/test/kv_state_cache_test_2.cc +++ b/test/kv_state_cache_test_2.cc @@ -24,11 +24,11 @@ limitations under the License. using namespace vineyard; -#define DEMENSION 10 +#define DIMENSION 10 #define CAPACITY 20 #define LAYER 3 -void init() { InitKVStateCache(DEMENSION, CAPACITY, LAYER); } +void init() { InitKVStateCache(DIMENSION, CAPACITY, LAYER); } void print_current_tokens(const std::vector& prefix, int next_token) { std::string tokens_str = ""; @@ -46,7 +46,7 @@ void print_kv_state( for (auto iter = kv_state.begin(); iter != kv_state.end(); ++iter) { std::string key_state_str = ""; std::string value_state_str = ""; - for (int i = 0; i < DEMENSION; ++i) { + for (int i = 0; i < DIMENSION; ++i) { key_state_str += std::to_string(iter->second.first[i]) + " "; value_state_str += std::to_string(iter->second.second[i]) + " "; } @@ -64,10 +64,10 @@ generate_kv_state(int token) { for (int currentLayer = 0; currentLayer < LAYER; currentLayer++) { std::vector key_state; std::vector value_state; - for (int i = 0; i < DEMENSION; ++i) { - key_state.push_back(((double) token) / DEMENSION * (i + 1) + + for (int i = 0; i < DIMENSION; ++i) { + key_state.push_back(((double) token) / DIMENSION * (i + 1) + currentLayer * 10); - value_state.push_back(((double) token) / DEMENSION * (i + 1) * 2 + + value_state.push_back(((double) token) / DIMENSION * (i + 1) * 2 + currentLayer * 10); }