support for min P on Kobold API

This commit is contained in:
RossAscends 2023-11-02 14:53:57 +09:00
parent 1966779ade
commit 75c6e74d41
4 changed files with 27 additions and 1 deletions

View File

@ -863,6 +863,20 @@
</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" name="volume" min="0" max="1" step="0.01">
</div>
<div class="range-block-counter">
<input type="number" min="0" max="1" step="0.01" data-for="min_p" id="min_p_counter">
</div>
</div>
</div>
<div class="range-block">
<div class="range-block-title" data-i18n="Top A">
Top A
@ -1027,7 +1041,7 @@
<small>1</small>
</div>
<div data-id="2">
<span data-i18n="Top P">Top P</span>
<span data-i18n="Top P">Top P & Min P</span>
<small>2</small>
</div>
<div data-id="3">

View File

@ -15,6 +15,7 @@ export const kai_settings = {
rep_pen: 1,
rep_pen_range: 0,
top_p: 1,
min_p: 0,
top_a: 1,
top_k: 0,
typical: 1,
@ -113,6 +114,7 @@ export function getKoboldGenerationData(finalPrompt, settings, maxLength, maxCon
top_a: kai_settings.top_a,
top_k: kai_settings.top_k,
top_p: kai_settings.top_p,
min_p: kai_settings.min_p,
typical: kai_settings.typical,
s1: sampler_order[0],
s2: sampler_order[1],
@ -207,6 +209,13 @@ const sliders = [
format: (val) => val,
setValue: (val) => { kai_settings.top_p = Number(val); },
},
{
name: "min_p",
sliderId: "#min_p",
counterId: "#min_p_counter",
format: (val) => val,
setValue: (val) => { kai_settings.min_p = Number(val); },
},
{
name: "top_a",
sliderId: "#top_a",

View File

@ -393,6 +393,7 @@ app.post("/generate", jsonParser, async function (request, response_generate) {
top_a: request.body.top_a,
top_k: request.body.top_k,
top_p: request.body.top_p,
min_p: request.body.min_p,
typical: request.body.typical,
sampler_order: sampler_order,
singleline: !!request.body.singleline,

View File

@ -897,6 +897,8 @@ export interface ModelGenerationInputKobold {
top_k?: number;
/** Top-p sampling value. */
top_p?: number;
/** Min-p sampling value. */
min_p?: number;
/** Typical sampling value. */
typical?: number;
/** Array of integers representing the sampler order to be used */