Make string ban more robust and add regex ban (#1243)

* Test new ctx_sampling->n_rewind system

* CRLF quickfix

* Adaptive p check

* merge banned_n

* Fix attempt 1

* Fix attempt 2
This commit is contained in:
SneedwareInc
2026-03-11 15:30:27 +01:00
committed by GitHub
parent fd4638f0e8
commit 4a247593dc
2 changed files with 271 additions and 67 deletions

View File

@@ -81,7 +81,7 @@ struct server_slot {
bool stopped_eos = false;
bool stopped_word = false;
bool stopped_limit = false;
bool saturate_predict = false;
bool oaicompat = false;
std::string oaicompat_model;
@@ -91,12 +91,16 @@ struct server_slot {
// For context rewind/ token buffer
size_t n_buffer = 0;
int32_t rewind_count = 0;
int32_t rewind_count_max = -1;
bool rewind_status = false;
std::unordered_map<llama_token, float> logit_bias;
std::vector<std::string>ban_phrases;
std::vector<std::string> ban_phrases;
std::vector<std::string> ban_regex;
std::vector<std::string> ban_regex_ci;
completion_token_outputs token_buffer;
float ban_phrases_bias = 0;
int32_t banned_n = 1;
std::map<int32_t, std::set<llama_token>> positional_bans;
server_prompt server_cached_prompt;