From 75c6e74d41b5fcd7f4d30bfafbe09ed60cad33c5 Mon Sep 17 00:00:00 2001
From: RossAscends <124905043+RossAscends@users.noreply.github.com>
Date: Thu, 2 Nov 2023 14:53:57 +0900
Subject: [PATCH] support for min P on Kobold API
---
public/index.html | 16 +++++++++++++++-
public/scripts/kai-settings.js | 9 +++++++++
server.js | 1 +
src/ai_horde/index.d.ts | 2 ++
4 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/public/index.html b/public/index.html
index f9a32a40a..b789e6986 100644
--- a/public/index.html
+++ b/public/index.html
@@ -863,6 +863,20 @@
+
Top A
@@ -1027,7 +1041,7 @@
1
- Top P
+ Top P & Min P
2
diff --git a/public/scripts/kai-settings.js b/public/scripts/kai-settings.js
index f7c808308..f2bc7ef73 100644
--- a/public/scripts/kai-settings.js
+++ b/public/scripts/kai-settings.js
@@ -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",
diff --git a/server.js b/server.js
index 96ce41c41..2b264bc57 100644
--- a/server.js
+++ b/server.js
@@ -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,
diff --git a/src/ai_horde/index.d.ts b/src/ai_horde/index.d.ts
index c57402c60..dda1c170f 100644
--- a/src/ai_horde/index.d.ts
+++ b/src/ai_horde/index.d.ts
@@ -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 */