@@ -4373,12 +4373,12 @@ struct logit_info {
43734373 std::vector<llama_token_data> min_heap; // min-heap by logit
43744374 llama_token const k_min = std::min (static_cast <llama_token>(k), n_vocab);
43754375 min_heap.reserve (k_min);
4376- for (llama_token token_id= 0 ; token_id< k_min ; ++token_id) {
4376+ for (llama_token token_id = 0 ; token_id < k_min ; ++token_id) {
43774377 min_heap.push_back (get_token_data (token_id));
43784378 }
43794379 auto comp = [](llama_token_data const & a, llama_token_data const & b) { return a.logit > b.logit ; };
43804380 std::make_heap (min_heap.begin (), min_heap.end (), comp);
4381- for (llama_token token_id= k_min ; token_id< n_vocab ; ++token_id) {
4381+ for (llama_token token_id = k_min ; token_id < n_vocab ; ++token_id) {
43824382 if (min_heap.front ().logit < logits[token_id]) {
43834383 std::pop_heap (min_heap.begin (), min_heap.end (), comp);
43844384 min_heap.back ().id = token_id;
@@ -4489,9 +4489,9 @@ struct beam_search {
44894489 // Requires beams is not empty.
44904490 size_t find_common_prefix_length () {
44914491 size_t common_prefix_length = beams[0 ].tokens .size ();
4492- for (size_t i= 1 ; i< beams.size () ; ++i) {
4492+ for (size_t i = 1 ; i < beams.size () ; ++i) {
44934493 common_prefix_length = std::min (common_prefix_length, beams[i].tokens .size ());
4494- for (size_t j= 0 ; j< common_prefix_length ; ++j) {
4494+ for (size_t j = 0 ; j < common_prefix_length ; ++j) {
44954495 if (beams[0 ].tokens [j] != beams[i].tokens [j]) {
44964496 common_prefix_length = j;
44974497 break ;
@@ -4504,7 +4504,7 @@ struct beam_search {
45044504 // Construct beams_state to send back to caller via the callback function.
45054505 // Side effect: set common_prefix_length = find_common_prefix_length();
45064506 llama_beams_state get_beams_state (bool const last_call) {
4507- for (size_t i= 0 ; i< beams.size () ; ++i) {
4507+ for (size_t i = 0 ; i < beams.size () ; ++i) {
45084508 beam_views[i] = beams[i].view ();
45094509 }
45104510 common_prefix_length = find_common_prefix_length ();
@@ -4519,7 +4519,7 @@ struct beam_search {
45194519 void loop (llama_beam_search_callback_fn_t const callback, void * const callback_data) {
45204520 beams.push_back ({{}, 1 .0f , false }); // Start with one empty beam w/ probability = 1.0 and !eos.
45214521 auto const not_eos = [](llama_beam const & beam) { return !beam.eos ; };
4522- for (int i= 0 ; i< n_predict && std::any_of (beams.begin (),beams.end (),not_eos) &&
4522+ for (int i = 0 ; i < n_predict && std::any_of (beams.begin (),beams.end (),not_eos) &&
45234523 !beams[top_beam_index ()].eos ; ++i) {
45244524 callback (callback_data, get_beams_state (false )); // Sets common_prefix_length
45254525 update_beams_from_beam_views (); // Update values (p,eos) that callback may have changed.
@@ -4556,7 +4556,7 @@ struct beam_search {
45564556
45574557 // Copy (p,eos) for each beam which may have been changed by the callback.
45584558 void update_beams_from_beam_views () {
4559- for (size_t i= 0 ; i< beams.size () ; ++i) {
4559+ for (size_t i = 0 ; i < beams.size () ; ++i) {
45604560 beams[i].p = beam_views[i].p ;
45614561 beams[i].eos = beam_views[i].eos ;
45624562 }
0 commit comments