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
1539
1539
}
1540
1540
auto prefix_tokens = tokenize (slot.params .input_prefix , false );
1541
1541
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) {
1544
1545
suffix_tokens.erase (suffix_tokens.begin ());
1545
1546
}
1547
+
1546
1548
prefix_tokens.insert (prefix_tokens.begin (), llama_token_prefix (ctx));
1547
1549
prefix_tokens.insert (prefix_tokens.begin (), llama_token_bos (ctx)); // always add BOS
1548
1550
prefix_tokens.insert (prefix_tokens.end (), llama_token_suffix (ctx));
You can’t perform that action at this time.
0 commit comments