Skip to content

Commit

Permalink
common, ngram_cache: added const reference for std::pair<> and std::…
Browse files Browse the repository at this point in the history
…tuple<> more 16 bytes: ggerganov#7270

Co-Authored-By: Herman Semenov <[email protected]>
  • Loading branch information
Nexesenex and GermanAizek committed Aug 15, 2024
1 parent c65f5b6 commit 14d93c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/ngram-cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ void llama_ngram_cache_draft(

void llama_ngram_cache_save(llama_ngram_cache & ngram_cache, std::string & filename) {
std::ofstream file_out(filename, std::ios::binary);
for (std::pair<llama_ngram, llama_ngram_cache_part> item : ngram_cache) {
for (const std::pair<llama_ngram, llama_ngram_cache_part> & item : ngram_cache) {
const llama_ngram ngram = item.first;
llama_ngram_cache_part token_counts = item.second;
GGML_ASSERT(!token_counts.empty());
Expand Down Expand Up @@ -366,7 +366,7 @@ llama_ngram_cache llama_ngram_cache_load(std::string & filename) {
}

void llama_ngram_cache_merge(llama_ngram_cache & ngram_cache_target, llama_ngram_cache & ngram_cache_add) {
for (std::pair<llama_ngram, llama_ngram_cache_part> ngram_part : ngram_cache_add) {
for (const std::pair<llama_ngram, llama_ngram_cache_part> & ngram_part : ngram_cache_add) {
const llama_ngram ngram = ngram_part.first;
llama_ngram_cache_part part = ngram_part.second;

Expand Down

0 comments on commit 14d93c7

Please sign in to comment.