@@ -826,9 +826,9 @@ struct llm_tokenizer_ugm_session {
826826 }
827827
828828 // initialize score_sum to -FLT_MAX so it will be always lower than sums of token scores
829- std::vector<struct best_tokenization > tokenization_results (input_len + 1 , {vocab.token_unk (), 0 , -FLT_MAX});
829+ std::vector<struct best_tokenization > tokenization_results (input_len + 1 , {0 , vocab.token_unk (), -FLT_MAX});
830830 // at the beginning tokenization score is zero
831- tokenization_results[0 ] = { vocab.token_unk (), 0 , 0 };
831+ tokenization_results[0 ] = { 0 , vocab.token_unk (), 0 };
832832
833833 for (size_t input_offset = 0 ; input_offset < input_len;) {
834834 size_t prefix_offset = input_offset;
@@ -858,7 +858,7 @@ struct llm_tokenizer_ugm_session {
858858 const double challenger_score = current_best.score_sum + token_score;
859859 struct best_tokenization & current_champ = tokenization_results[prefix_offset];
860860 if (challenger_score > current_champ.score_sum ) {
861- struct best_tokenization challenger = { token_id, input_offset , (float ) challenger_score };
861+ struct best_tokenization challenger = { input_offset, token_id , (float ) challenger_score };
862862 current_champ = challenger;
863863 }
864864 }
@@ -872,7 +872,7 @@ struct llm_tokenizer_ugm_session {
872872 prefix_offset = input_offset + n_utf8_code_units;
873873 struct best_tokenization & current_champ = tokenization_results[prefix_offset];
874874 if (challenger_score > current_champ.score_sum ) {
875- struct best_tokenization challenger = { vocab.token_unk (), input_offset , (float ) challenger_score };
875+ struct best_tokenization challenger = { input_offset, vocab.token_unk (), (float ) challenger_score };
876876 current_champ = challenger;
877877 }
878878 }
@@ -996,8 +996,8 @@ struct llm_tokenizer_ugm_session {
996996
997997 // this structure stores the best tokenization so far at input_offset
998998 struct best_tokenization {
999- llama_token token_id;
1000999 size_t input_offset;
1000+ llama_token token_id;
10011001 float score_sum;
10021002 };
10031003
0 commit comments