mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-10 17:14:36 +00:00
fixed dry loading seq when not in use, set kcppt to -1 layers by default
This commit is contained in:
parent
0ecf13fc13
commit
e2b36aa6cf
2 changed files with 44 additions and 28 deletions
|
@ -2081,40 +2081,55 @@ generation_outputs gpttype_generate(const generation_inputs inputs)
|
|||
|
||||
// Parse dry sequence breakers / restart sequences
|
||||
kcpp_params->dry_sequence_breakers.clear();
|
||||
for(int x=0;x<dry_seq_break_max;++x) {
|
||||
std::string word = inputs.dry_sequence_breakers[x];
|
||||
if(word!="") {
|
||||
kcpp_params->dry_sequence_breakers.push_back(word);
|
||||
}
|
||||
}
|
||||
dry_sequence_breakers.clear();
|
||||
if(kcpp_params->dry_sequence_breakers.size()>0) {
|
||||
// Restrict the maximum length of sequences used as sequence breakers. There are
|
||||
// very few use cases for a long sequence breaker, and limiting the max length
|
||||
// prevents a potential denial of service attack in which long repetitive sequence
|
||||
// breakers could result in slow DRY sampling with a suitably crafted context.
|
||||
const int MAX_CHAR_LEN = 40;
|
||||
const int MAX_SEQ_LEN = 20;
|
||||
|
||||
if(debugmode==1) {
|
||||
printf("\nProcessing %zu dry break strings...",kcpp_params->dry_sequence_breakers.size());
|
||||
}
|
||||
for (auto sequence_break: kcpp_params->dry_sequence_breakers) {
|
||||
if (sequence_break.size() > MAX_CHAR_LEN) {
|
||||
sequence_break.resize(MAX_CHAR_LEN);
|
||||
if (kcpp_params->dry_multiplier > 0)
|
||||
{
|
||||
for (int x = 0; x < dry_seq_break_max; ++x)
|
||||
{
|
||||
std::string word = inputs.dry_sequence_breakers[x];
|
||||
if (word != "")
|
||||
{
|
||||
kcpp_params->dry_sequence_breakers.push_back(word);
|
||||
}
|
||||
GetOverlappingTokenSequences(sequence_break, dry_sequence_breakers, MAX_SEQ_LEN);
|
||||
}
|
||||
if(debugmode==1) {
|
||||
int trivial = 0, non_trivial = 0;
|
||||
for (const auto& seq: dry_sequence_breakers) {
|
||||
if (seq.second.empty()) {
|
||||
++trivial;
|
||||
} else {
|
||||
++non_trivial;
|
||||
if (kcpp_params->dry_sequence_breakers.size() > 0)
|
||||
{
|
||||
// Restrict the maximum length of sequences used as sequence breakers. There are
|
||||
// very few use cases for a long sequence breaker, and limiting the max length
|
||||
// prevents a potential denial of service attack in which long repetitive sequence
|
||||
// breakers could result in slow DRY sampling with a suitably crafted context.
|
||||
const int MAX_CHAR_LEN = 40;
|
||||
const int MAX_SEQ_LEN = 20;
|
||||
|
||||
if (debugmode == 1)
|
||||
{
|
||||
printf("\nProcessing %zu dry break strings...", kcpp_params->dry_sequence_breakers.size());
|
||||
}
|
||||
for (auto sequence_break : kcpp_params->dry_sequence_breakers)
|
||||
{
|
||||
if (sequence_break.size() > MAX_CHAR_LEN)
|
||||
{
|
||||
sequence_break.resize(MAX_CHAR_LEN);
|
||||
}
|
||||
GetOverlappingTokenSequences(sequence_break, dry_sequence_breakers, MAX_SEQ_LEN);
|
||||
}
|
||||
if (debugmode == 1)
|
||||
{
|
||||
int trivial = 0, non_trivial = 0;
|
||||
for (const auto &seq : dry_sequence_breakers)
|
||||
{
|
||||
if (seq.second.empty())
|
||||
{
|
||||
++trivial;
|
||||
}
|
||||
else
|
||||
{
|
||||
++non_trivial;
|
||||
}
|
||||
}
|
||||
printf("\nFound a total of %zu restart heads, %d trivial, %d non-trivial.\n", dry_sequence_breakers.size(), trivial, non_trivial);
|
||||
}
|
||||
printf("\nFound a total of %zu restart heads, %d trivial, %d non-trivial.\n", dry_sequence_breakers.size(), trivial, non_trivial);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue