Merge pull request #809 from mweldon/kayra

This commit is contained in:
Cohee 2023-07-29 13:02:39 +03:00 committed by GitHub
commit 763a443680
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 301 additions and 19 deletions

View File

@ -0,0 +1,18 @@
{
"order": [5, 0, 1, 3],
"temperature": 1.23,
"max_length": 300,
"min_length": 1,
"top_k": 200,
"typical_p": 0.966,
"tail_free_sampling": 0.982,
"repetition_penalty": 1.74,
"repetition_penalty_range": 4000,
"repetition_penalty_frequency": 0,
"repetition_penalty_presence": 0.02,
"use_cache": false,
"return_full_text": false,
"prefix": "vanilla",
"phrase_rep_pen": "aggressive",
"max_context": 8192
}

View File

@ -0,0 +1,19 @@
{
"order": [6, 0, 1, 2, 3],
"temperature": 1,
"max_length": 300,
"min_length": 1,
"top_k": 25,
"top_p": 1,
"tail_free_sampling": 0.925,
"repetition_penalty": 1.6,
"repetition_penalty_frequency": 0.001,
"repetition_penalty_range": 0,
"repetition_penalty_presence": 0,
"use_cache": false,
"return_full_text": false,
"prefix": "vanilla",
"phrase_rep_pen": "medium",
"cfg_scale": 1.55,
"max_context": 8192
}

View File

@ -0,0 +1,20 @@
{
"order": [6, 2, 3, 1, 0],
"temperature": 1,
"max_length": 300,
"min_length": 1,
"top_k": 0,
"top_p": 0.96,
"tail_free_sampling": 0.96,
"repetition_penalty": 2,
"repetition_penalty_slope": 1,
"repetition_penalty_frequency": 0.02,
"repetition_penalty_range": 0,
"repetition_penalty_presence": 0.3,
"use_cache": false,
"return_full_text": false,
"prefix": "vanilla",
"phrase_rep_pen": "very_aggressive",
"cfg_scale": 1.3,
"max_context": 8192
}

View File

@ -1,20 +1,20 @@
{
"order": [2, 3, 0, 4, 1],
"temperature": 1.05,
"temperature": 1.35,
"max_length": 300,
"min_length": 1,
"top_k": 12,
"top_p": 0.85,
"top_a": 0.1,
"typical_p": 1,
"tail_free_sampling": 0.915,
"repetition_penalty": 2.8,
"repetition_penalty_range": 2048,
"repetition_penalty_slope": 0.02,
"repetition_penalty_frequency": 0.03,
"repetition_penalty_presence": 0.0,
"repetition_penalty_frequency": 0.02,
"repetition_penalty_presence": 0,
"use_cache": false,
"return_full_text": false,
"prefix": "vanilla",
"phrase_rep_pen": "aggressive",
"max_context": 8192
}

View File

@ -0,0 +1,20 @@
{
"order": [4, 0, 5, 3, 2],
"temperature": 1.09,
"max_length": 300,
"min_length": 1,
"top_p": 0.969,
"top_a": 0.09,
"typical_p": 0.99,
"tail_free_sampling": 0.969,
"repetition_penalty": 1.09,
"repetition_penalty_range": 8192,
"repetition_penalty_slope": 0.069,
"repetition_penalty_frequency": 0.006,
"repetition_penalty_presence": 0.009,
"use_cache": false,
"return_full_text": false,
"prefix": "vanilla",
"phrase_rep_pen": "very_light",
"max_context": 8192
}

View File

@ -0,0 +1,19 @@
{
"order": [6, 0, 1, 2, 3],
"temperature": 1,
"max_length": 300,
"min_length": 1,
"top_k": 25,
"top_p": 1,
"tail_free_sampling": 0.925,
"repetition_penalty": 1.9,
"repetition_penalty_range": 768,
"repetition_penalty_slope": 1,
"repetition_penalty_frequency": 0.0025,
"repetition_penalty_presence": 0.001,
"use_cache": false,
"return_full_text": false,
"prefix": "vanilla",
"phrase_rep_pen": "off",
"max_context": 8192
}

View File

@ -0,0 +1,19 @@
{
"order": [6, 1, 0, 5, 3],
"temperature": 1.25,
"max_length": 300,
"min_length": 1,
"top_k": 70,
"typical_p": 0.9,
"tail_free_sampling": 0.925,
"repetition_penalty": 2,
"repetition_penalty_range": 1632,
"repetition_penalty_frequency": 0,
"repetition_penalty_presence": 0,
"use_cache": false,
"return_full_text": false,
"prefix": "vanilla",
"phrase_rep_pen": "aggressive",
"cfg_scale": 1.825,
"max_context": 8192
}

View File

@ -0,0 +1,22 @@
{
"order": [6, 0, 4, 1, 2, 5, 3],
"temperature": 1.31,
"max_length": 300,
"min_length": 1,
"top_k": 25,
"top_p": 0.97,
"top_a": 0.18,
"typical_p": 0.98,
"tail_free_sampling": 1,
"repetition_penalty": 1.55,
"repetition_penalty_frequency": 0.00075,
"repetition_penalty_presence": 0.00085,
"repetition_penalty_range": 8192,
"repetition_penalty_slope": 1.8,
"use_cache": false,
"return_full_text": false,
"prefix": "vanilla",
"phrase_rep_pen": "medium",
"cfg_scale": 1.35,
"max_context": 8192
}

View File

@ -0,0 +1,17 @@
{
"order": [3, 0, 5],
"temperature": 2.5,
"max_length": 300,
"min_length": 1,
"typical_p": 0.966,
"tail_free_sampling": 0.933,
"repetition_penalty": 1,
"repetition_penalty_range": 2048,
"repetition_penalty_frequency": 0,
"repetition_penalty_presence": 0,
"use_cache": false,
"return_full_text": false,
"prefix": "vanilla",
"phrase_rep_pen": "aggressive",
"max_context": 8192
}

View File

@ -1,20 +1,21 @@
{
"order": [1, 3, 4, 0, 2],
"temperature": 1.05,
"max_length": 40,
"order": [1, 5, 0, 2, 3, 4],
"temperature": 1.5,
"max_length": 300,
"min_length": 1,
"top_k": 79,
"top_p": 0.95,
"top_a": 0.075,
"typical_p": 1,
"tail_free_sampling": 0.989,
"repetition_penalty": 1.5,
"top_k": 10,
"top_p": 0.75,
"top_a": 0.08,
"typical_p": 0.975,
"tail_free_sampling": 0.967,
"repetition_penalty": 2.25,
"repetition_penalty_range": 8192,
"repetition_penalty_slope": 3.33,
"repetition_penalty_frequency": 0.03,
"repetition_penalty_slope": 0.09,
"repetition_penalty_frequency": 0,
"repetition_penalty_presence": 0.005,
"use_cache": false,
"return_full_text": false,
"prefix": "vanilla",
"phrase_rep_pen": "very_light",
"max_context": 8192
}

View File

@ -0,0 +1,18 @@
{
"order": [6, 0, 5],
"temperature": 0.895,
"max_length": 300,
"min_length": 1,
"typical_p": 0.9,
"repetition_penalty": 2,
"repetition_penalty_slope": 3.2,
"repetition_penalty_frequency": 0,
"repetition_penalty_presence": 0,
"repetition_penalty_range": 4048,
"use_cache": false,
"return_full_text": false,
"prefix": "vanilla",
"phrase_rep_pen": "aggressive",
"cfg_scale": 1.3,
"max_context": 8192
}

View File

@ -0,0 +1,19 @@
{
"order": [6, 1, 0, 5, 3, 2],
"temperature": 1.5,
"max_length": 300,
"min_length": 1,
"top_k": 70,
"top_p": 0.95,
"typical_p": 0.95,
"tail_free_sampling": 0.95,
"repetition_penalty": 1.6,
"repetition_penalty_range": 2016,
"repetition_penalty_frequency": 0,
"repetition_penalty_presence": 0,
"use_cache": false,
"return_full_text": false,
"prefix": "vanilla",
"phrase_rep_pen": "very_aggressive",
"max_context": 8192
}

View File

@ -867,6 +867,36 @@
</div>
</div>
</div>
<div class="range-block">
<div class="range-block-title" data-i18n="CFG Scale">
CFG Scale
</div>
<div class="range-block-range-and-counter">
<div class="range-block-range">
<input type="range" id="cfg_scale_novel" name="volume" min="1" max="3" step="0.05">
</div>
<div class="range-block-counter">
<div contenteditable="true" data-for="cfg_scale_novel" id="cfg_scale_counter_novel">
select
</div>
</div>
</div>
</div>
<div class="range-block">
<div class="range-block-title" data-i18n="Phrase Repetition Penalty">
Phrase Repetition Penalty
</div>
<div class="range-block-range-and-counter">
<div class="range-block-range">
<input type="range" id="phrase_rep_pen_novel" name="volume" min="0" max="5" step="1">
</div>
<div class="range-block-counter">
<div contenteditable="true" data-for="phrase_rep_pen_novel" id="phrase_rep_pen_counter_novel">
select
</div>
</div>
</div>
</div>
<div class="range-block">
<div class="range-block-title" data-i18n="Min Length">
Min Length

View File

@ -62,6 +62,8 @@ function loadNovelPreset(preset) {
nai_settings.top_a = preset.top_a;
nai_settings.typical_p = preset.typical_p;
nai_settings.min_length = preset.min_length;
nai_settings.cfg_scale = preset.cfg_scale;
nai_settings.phrase_rep_pen = preset.phrase_rep_pen;
loadNovelSettingsUi(nai_settings);
}
@ -84,6 +86,8 @@ function loadNovelSettings(settings) {
nai_settings.top_a = settings.top_a;
nai_settings.typical_p = settings.typical_p;
nai_settings.min_length = settings.min_length;
nai_settings.phrase_rep_pen = settings.phrase_rep_pen;
nai_settings.cfg_scale = settings.cfg_scale;
nai_settings.streaming_novel = !!settings.streaming_novel;
loadNovelSettingsUi(nai_settings);
@ -95,6 +99,39 @@ function loadNovelSettings(settings) {
}
}
const phraseRepPenStrings = [
null,
"very_light",
"light",
"medium",
"aggressive",
"very_aggressive"
]
function getPhraseRepPenString(phraseRepPenCounter) {
if (phraseRepPenCounter < 1 || phraseRepPenCounter > F5) {
return null;
} else {
return phraseRepPenStrings[phraseRepPenCounter];
}
}
function getPhraseRepPenCounter(phraseRepPenString) {
if (phraseRepPenString === phraseRepPenStrings[1]) {
return 1;
} else if (phraseRepPenString === phraseRepPenStrings[2]) {
return 2;
} else if (phraseRepPenString === phraseRepPenStrings[3]) {
return 3;
} else if (phraseRepPenString === phraseRepPenStrings[4]) {
return 4;
} else if (phraseRepPenString === phraseRepPenStrings[5]) {
return 5;
} else {
return 0;
}
}
function loadNovelSettingsUi(ui_settings) {
$("#temp_novel").val(ui_settings.temperature);
$("#temp_counter_novel").text(Number(ui_settings.temperature).toFixed(2));
@ -118,6 +155,10 @@ function loadNovelSettingsUi(ui_settings) {
$("#top_a_counter_novel").text(Number(ui_settings.top_a).toFixed(2));
$("#typical_p_novel").val(ui_settings.typical_p);
$("#typical_p_counter_novel").text(Number(ui_settings.typical_p).toFixed(2));
$("#cfg_scale_novel").val(ui_settings.cfg_scale);
$("#cfg_scale_counter_novel").text(Number(ui_settings.cfg_scale).toFixed(2));
$("#phrase_rep_pen_novel").val(getPhraseRepPenCounter(ui_settings.phrase_rep_pen));
$("#phrase_rep_pen_counter_novel").text(getPhraseRepPenCounter(ui_settings.phrase_rep_pen));
$("#min_length_novel").val(ui_settings.min_length);
$("#min_length_counter_novel").text(Number(ui_settings.min_length).toFixed(0));
@ -191,6 +232,18 @@ const sliders = [
format: (val) => Number(val).toFixed(2),
setValue: (val) => { nai_settings.typical_p = Number(val).toFixed(2); },
},
{
sliderId: "#cfg_scale_novel",
counterId: "#cfg_scale_counter_novel",
format: (val) => `${val}`,
setValue: (val) => { nai_settings.cfg_scale = Number(val).toFixed(2); },
},
{
sliderId: "#phrase_rep_pen_novel",
counterId: "#phrase_rep_pen_counter_novel",
format: (val) => `${val}`,
setValue: (val) => { nai_settings.phrase_rep_pen = getPhraseRepPenString(Number(val).toFixed(0)); },
},
{
sliderId: "#min_length_novel",
counterId: "#min_length_counter_novel",
@ -200,6 +253,7 @@ const sliders = [
];
export function getNovelGenerationData(finalPromt, this_settings, this_amount_gen) {
const isNewModel = (nai_settings.model_novel.includes('clio') || nai_settings.model_novel.includes('kayra'));
return {
"input": finalPromt,
"model": nai_settings.model_novel,
@ -217,13 +271,16 @@ export function getNovelGenerationData(finalPromt, this_settings, this_amount_ge
"top_p": parseFloat(nai_settings.top_p),
"top_k": parseInt(nai_settings.top_k),
"typical_p": parseFloat(nai_settings.typical_p),
"cfg_scale": parseFloat(nai_settings.cfg_scale),
"cfg_uc": "",
"phrase_rep_pen": nai_settings.phrase_rep_pen,
//"stop_sequences": {{187}},
//bad_words_ids = {{50256}, {0}, {1}};
"generate_until_sentence": true,
"use_cache": false,
"use_string": true,
"return_full_text": false,
"prefix": "vanilla",
"prefix": isNewModel ? "special_instruct" : "vanilla",
"order": this_settings.order,
"streaming": nai_settings.streaming_novel,
};

View File

@ -1786,7 +1786,7 @@ app.post("/generate_novelai", jsonParser, async function (request, response_gene
console.log(request.body);
const bw = require('./src/bad-words');
const bad_words_ids = request.body.model.includes('clio') ? bw.clioBadWordsId : bw.badWordIds;
const isNewModel = (request.body.model.includes('clio') || request.body.model.includes('kayra'));
const data = {
"input": request.body.input,
"model": request.body.model,
@ -1805,13 +1805,16 @@ app.post("/generate_novelai", jsonParser, async function (request, response_gene
"top_p": request.body.top_p,
"top_k": request.body.top_k,
"typical_p": request.body.typical_p,
"cfg_scale": request.body.cfg_scale,
"cfg_uc": request.body.cfg_uc,
"phrase_rep_pen": request.body.phrase_rep_pen,
//"stop_sequences": {{187}},
"bad_words_ids": bad_words_ids,
"bad_words_ids": isNewModel ? bw.clioBadWordsId : bw.badWordIds,
//generate_until_sentence = true;
"use_cache": request.body.use_cache,
"use_string": true,
"return_full_text": request.body.return_full_text,
"prefix": request.body.prefix,
"prefix": isNewModel ? "special_instruct" : request.body.prefix,
"order": request.body.order
}
};