Skip to content

Commit

Permalink
Minor:fix spelling error.
Browse files Browse the repository at this point in the history
Signed-off-by: vegetableysm <[email protected]>
  • Loading branch information
vegetableysm committed Feb 26, 2024
1 parent df8825d commit 5afe6c2
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions modules/kv-state-cache/ds/kv_state_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ KVStateCacheBuilder::KVStateCacheBuilder(Client& client, int dimension,
KVStateCacheBuilder::KVStateCacheBuilder(Client& client,
std::shared_ptr<KVStateCache> cache) {
// TBD
this->dimension = cache->GetDemension();
this->dimension = cache->GetDimension();
this->version = cache->GetVersion();
this->layer = cache->GetLayer();
// 1. create block builder from block
Expand Down Expand Up @@ -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<NodeData> evictedNodeData = nullptr;
this->rootTree->Delete(tokenListCopy, evictedNodeData);

Expand Down
4 changes: 2 additions & 2 deletions modules/kv-state-cache/ds/kv_state_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class KVStateCache : public vineyard::Registered<KVStateCache> {
return this->kvStateCacheBlockList;
}

int GetDemension() { return this->dimension; }
int GetDimension() { return this->dimension; }

int GetCacheCapacity() { return this->cacheCapacity; }

Expand Down Expand Up @@ -110,7 +110,7 @@ class KVStateCacheBuilder : public vineyard::ObjectBuilder {

std::shared_ptr<Object> _Seal(Client& client) override;

uint64_t GetDemension() { return this->dimension; }
uint64_t GetDimension() { return this->dimension; }

std::shared_ptr<RadixTree> GetRootTree() { return this->rootTree; }

Expand Down
2 changes: 1 addition & 1 deletion modules/kv-state-cache/ds/kv_state_cache_block.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ void KVStateCacheBlockBuilder::Update(const KV_STATE_WITH_LAYER& kvState,
std::vector<double> 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);

Expand Down
2 changes: 1 addition & 1 deletion modules/kv-state-cache/ds/kv_state_cache_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions test/kv_state_cache_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>& prefix, int next_token) {
std::string tokens_str = "";
Expand All @@ -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]) + " ";
}
Expand All @@ -65,10 +65,10 @@ generate_kv_state(int token) {
for (int currentLayer = 0; currentLayer < LAYER; currentLayer++) {
std::vector<double> key_state;
std::vector<double> 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);
}

Expand Down
12 changes: 6 additions & 6 deletions test/kv_state_cache_test_2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>& prefix, int next_token) {
std::string tokens_str = "";
Expand All @@ -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]) + " ";
}
Expand All @@ -64,10 +64,10 @@ generate_kv_state(int token) {
for (int currentLayer = 0; currentLayer < LAYER; currentLayer++) {
std::vector<double> key_state;
std::vector<double> 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);
}

Expand Down

0 comments on commit 5afe6c2

Please sign in to comment.