mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2025-11-04 09:32:00 +00:00
removing any leading whitespace from infill suffix and removing leeading space token from suffix when params.escape
This commit is contained in:
@@ -344,8 +344,13 @@ struct llama_server_context
|
||||
|
||||
void loadInfill()
|
||||
{
|
||||
params.input_suffix.erase(0, params.input_suffix.find_first_not_of(" "));
|
||||
auto prefix_tokens = tokenize(params.input_prefix, false);
|
||||
auto suffix_tokens = tokenize(params.input_suffix, false);
|
||||
const int space_token = 29871;
|
||||
if (params.escape && suffix_tokens.size() > 1 && suffix_tokens[0] == space_token) {
|
||||
suffix_tokens.erase(suffix_tokens.begin());
|
||||
}
|
||||
prefix_tokens.insert(prefix_tokens.begin(), llama_token_prefix(ctx));
|
||||
prefix_tokens.insert(prefix_tokens.begin(), llama_token_bos(ctx)); // always add BOS
|
||||
prefix_tokens.insert(prefix_tokens.end(), llama_token_suffix(ctx));
|
||||
|
||||
Reference in New Issue
Block a user