File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -1539,10 +1539,12 @@ struct llama_server_context
15391539 }
15401540 auto prefix_tokens = tokenize (slot.params .input_prefix , false );
15411541 auto suffix_tokens = tokenize (slot.params .input_suffix , false );
1542- const int space_token = 29871 ;
1543- if (suff_rm_leading_spc && suffix_tokens[0 ] == space_token) {
1542+
1543+ const int space_token = 29871 ; // TODO: this should not be hardcoded
1544+ if (suff_rm_leading_spc && !suffix_tokens.empty () && suffix_tokens[0 ] == space_token) {
15441545 suffix_tokens.erase (suffix_tokens.begin ());
15451546 }
1547+
15461548 prefix_tokens.insert (prefix_tokens.begin (), llama_token_prefix (ctx));
15471549 prefix_tokens.insert (prefix_tokens.begin (), llama_token_bos (ctx)); // always add BOS
15481550 prefix_tokens.insert (prefix_tokens.end (), llama_token_suffix (ctx));
You can’t perform that action at this time.
0 commit comments