Add Min P for Novel

This commit is contained in:
Cohee 2024-09-20 22:42:56 +03:00
parent 6d32cd6bf0
commit 8efe0b6437
22 changed files with 64 additions and 19 deletions

View File

@ -16,5 +16,6 @@
"prefix": "vanilla",
"cfg_scale": 1,
"phrase_rep_pen": "medium",
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -15,5 +15,6 @@
"prefix": "vanilla",
"phrase_rep_pen": "medium",
"cfg_scale": 1.55,
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -16,5 +16,6 @@
"prefix": "vanilla",
"phrase_rep_pen": "very_aggressive",
"cfg_scale": 1.3,
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -17,5 +17,6 @@
"prefix": "vanilla",
"cfg_scale": 1,
"phrase_rep_pen": "aggressive",
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -16,5 +16,6 @@
"prefix": "vanilla",
"phrase_rep_pen": "off",
"cfg_scale": 1.48,
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -17,5 +17,6 @@
"prefix": "vanilla",
"cfg_scale": 1,
"phrase_rep_pen": "very_light",
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -18,5 +18,6 @@
"prefix": "vanilla",
"cfg_scale": 1,
"phrase_rep_pen": "very_light",
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -16,5 +16,6 @@
"prefix": "vanilla",
"cfg_scale": 1,
"phrase_rep_pen": "off",
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -16,5 +16,6 @@
"prefix": "vanilla",
"phrase_rep_pen": "very_aggressive",
"cfg_scale": 1.4,
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -18,5 +18,6 @@
"prefix": "vanilla",
"cfg_scale": 1,
"phrase_rep_pen": "very_light",
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -18,5 +18,6 @@
"prefix": "vanilla",
"cfg_scale": 1,
"phrase_rep_pen": "very_light",
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -18,5 +18,6 @@
"prefix": "vanilla",
"phrase_rep_pen": "medium",
"cfg_scale": 1.35,
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -16,5 +16,6 @@
"prefix": "vanilla",
"phrase_rep_pen": "medium",
"cfg_scale": 1.0,
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -13,5 +13,6 @@
"return_full_text": false,
"prefix": "vanilla",
"phrase_rep_pen": "medium",
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -18,5 +18,6 @@
"prefix": "vanilla",
"cfg_scale": 1,
"phrase_rep_pen": "very_light",
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -15,5 +15,6 @@
"prefix": "vanilla",
"phrase_rep_pen": "aggressive",
"cfg_scale": 1.0,
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -14,5 +14,6 @@
"prefix": "vanilla",
"phrase_rep_pen": "aggressive",
"cfg_scale": 1.3,
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -18,5 +18,6 @@
"prefix": "vanilla",
"cfg_scale": 1,
"phrase_rep_pen": "very_light",
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -17,5 +17,6 @@
"return_full_text": false,
"prefix": "vanilla",
"phrase_rep_pen": "very_aggressive",
"max_context": 7800
"max_context": 7800,
"min_p": 0
}

View File

@ -323,6 +323,19 @@
</div>
</div>
</div>
<div class="range-block">
<div class="range-block-title" data-i18n="Min P">
Min P
</div>
<div class="range-block-range-and-counter">
<div class="range-block-range">
<input type="range" id="min_p_novel" name="volume" min="0" max="1" step="0.001">
</div>
<div class="range-block-counter">
<input type="number" min="0" max="1" step="0.001" data-for="min_p_novel" id="min_p_counter_novel">
</div>
</div>
</div>
<div class="range-block">
<div class="range-block-title" data-i18n="TFS">
TFS

View File

@ -38,6 +38,7 @@ export const nai_settings = {
top_p: 0.75,
top_a: 0.08,
typical_p: 0.975,
min_p: 0,
min_length: 1,
model_novel: 'clio-v1',
preset_settings_novel: 'Talker-Chat-Clio',
@ -151,6 +152,7 @@ export function loadNovelPreset(preset) {
nai_settings.order = preset.order || default_order;
nai_settings.logit_bias = preset.logit_bias || [];
nai_settings.preamble = preset.preamble || default_preamble;
nai_settings.min_p = preset.min_p || 0;
loadNovelSettingsUi(nai_settings);
}
@ -188,6 +190,7 @@ export function loadNovelSettings(settings) {
nai_settings.banned_tokens = settings.banned_tokens || '';
nai_settings.order = settings.order || default_order;
nai_settings.logit_bias = settings.logit_bias || [];
nai_settings.min_p = settings.min_p || 0;
loadNovelSettingsUi(nai_settings);
}
@ -227,6 +230,8 @@ function loadNovelSettingsUi(ui_settings) {
$('#nai_prefix').val(ui_settings.prefix || 'vanilla');
$('#nai_cfg_uc').val(ui_settings.cfg_uc || '');
$('#nai_banned_tokens').val(ui_settings.banned_tokens || '');
$('#min_p_novel').val(ui_settings.min_p);
$('#min_p_counter_novel').val(Number(ui_settings.min_p).toFixed(3));
$('#streaming_novel').prop('checked', ui_settings.streaming_novel);
sortItemsByOrder(ui_settings.order);
@ -336,6 +341,12 @@ const sliders = [
format: (val) => val,
setValue: (val) => { nai_settings.banned_tokens = val; },
},
{
sliderId: '#min_p_novel',
counterId: '#min_p_counter_novel',
format: (val) => Number(val).toFixed(3),
setValue: (val) => { nai_settings.min_p = Number(val); },
},
];
function getBadWordIds(banned_tokens, tokenizerType) {
@ -469,6 +480,7 @@ export function getNovelGenerationData(finalPrompt, settings, maxLength, isImper
'top_a': Number(nai_settings.top_a),
'top_p': Number(nai_settings.top_p),
'top_k': Number(nai_settings.top_k),
'min_p': Number(nai_settings.min_p),
'typical_p': Number(nai_settings.typical_p),
'mirostat_lr': Number(nai_settings.mirostat_lr),
'mirostat_tau': Number(nai_settings.mirostat_tau),

View File

@ -175,6 +175,7 @@ router.post('/generate', jsonParser, async function (req, res) {
'prefix': req.body.prefix,
'order': req.body.order,
'num_logprobs': req.body.num_logprobs,
'min_p': req.body.min_p,
},
};