Skip to content

Commit

Permalink
llama : std::move llm_bigram_bpe from work_queue
Browse files Browse the repository at this point in the history
This commit updates the retrieval of llm_bigram_bpe objects from
work_queue.top() by using std::move.

The motivation for this is to avoid the copying of the std::string
`text` member of the llm_bigram_bpe struct.
  • Loading branch information
danbev committed Aug 17, 2024
1 parent 8b3befc commit 6c6db7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/llama-vocab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ struct llm_tokenizer_bpe {

// build token(s)
while (!work_queue.empty()) {
auto bigram = work_queue.top();
auto bigram = std::move(const_cast<llm_bigram_bpe&>(work_queue.top()));
work_queue.pop();

auto & left_symbol = symbols[bigram.left];
Expand Down

0 comments on commit 6c6db7b

Please sign in to comment.