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
|
// Parse dry sequence breakers / restart sequences
|
||||||
kcpp_params->dry_sequence_breakers.clear();
|
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();
|
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) {
|
if (kcpp_params->dry_multiplier > 0)
|
||||||
printf("\nProcessing %zu dry break strings...",kcpp_params->dry_sequence_breakers.size());
|
{
|
||||||
}
|
for (int x = 0; x < dry_seq_break_max; ++x)
|
||||||
for (auto sequence_break: kcpp_params->dry_sequence_breakers) {
|
{
|
||||||
if (sequence_break.size() > MAX_CHAR_LEN) {
|
std::string word = inputs.dry_sequence_breakers[x];
|
||||||
sequence_break.resize(MAX_CHAR_LEN);
|
if (word != "")
|
||||||
|
{
|
||||||
|
kcpp_params->dry_sequence_breakers.push_back(word);
|
||||||
}
|
}
|
||||||
GetOverlappingTokenSequences(sequence_break, dry_sequence_breakers, MAX_SEQ_LEN);
|
|
||||||
}
|
}
|
||||||
if(debugmode==1) {
|
if (kcpp_params->dry_sequence_breakers.size() > 0)
|
||||||
int trivial = 0, non_trivial = 0;
|
{
|
||||||
for (const auto& seq: dry_sequence_breakers) {
|
// Restrict the maximum length of sequences used as sequence breakers. There are
|
||||||
if (seq.second.empty()) {
|
// very few use cases for a long sequence breaker, and limiting the max length
|
||||||
++trivial;
|
// prevents a potential denial of service attack in which long repetitive sequence
|
||||||
} else {
|
// breakers could result in slow DRY sampling with a suitably crafted context.
|
||||||
++non_trivial;
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2742,6 +2742,7 @@ def show_gui():
|
||||||
savdict = json.loads(json.dumps(args.__dict__))
|
savdict = json.loads(json.dumps(args.__dict__))
|
||||||
file_type = [("KoboldCpp LaunchTemplate", "*.kcppt")]
|
file_type = [("KoboldCpp LaunchTemplate", "*.kcppt")]
|
||||||
savdict["istemplate"] = True
|
savdict["istemplate"] = True
|
||||||
|
savdict["gpulayers"] = -1
|
||||||
filename = asksaveasfile(filetypes=file_type, defaultextension=file_type)
|
filename = asksaveasfile(filetypes=file_type, defaultextension=file_type)
|
||||||
if filename == None: return
|
if filename == None: return
|
||||||
file = open(str(filename.name), 'a')
|
file = open(str(filename.name), 'a')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue