From bf66a3957907e50064e7ab23988ba8000b50fdb8 Mon Sep 17 00:00:00 2001 From: DocShotgun <126566557+DocShotgun@users.noreply.github.com> Date: Tue, 6 May 2025 00:32:29 -0700 Subject: [PATCH 1/4] Update llama.cpp textgen settings * Add min_keep, a llama.cpp-exclusive setting for constraining the effect of truncation samplers * Enable nsigma for llama.cpp, and add llama.cpp alias top_n_sigma, add nsigma to the llama.cpp sampler order block * Allow a negative value of nsigma as this represents 'disabled' in llama.cpp (while 0 is deterministic) * Remove tfs and top_a as these are not supported by llama.cpp (tfs was removed, and top_a was never supported) * Correct the identification string for typical_p in the llama.cpp sampler order block * Add penalties to the llama.cpp sampler order block --- public/index.html | 23 ++++++++++++++++------- public/scripts/textgen-settings.js | 12 +++++++++--- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/public/index.html b/public/index.html index 954a0a57d..5fae60354 100644 --- a/public/index.html +++ b/public/index.html @@ -1284,7 +1284,7 @@ -
+
Top A
@@ -1292,7 +1292,7 @@
-
+
TFS
@@ -1308,13 +1308,21 @@
-
+
Top nsigma
- - + + +
+
+ + Min Keep +
+
+ +
@@ -1769,11 +1777,12 @@
Temperature
Top K
Top P
-
Typical P
-
Tail Free Sampling
+
Typical P
Min P
Exclude Top Choices
DRY
+
Rep/Freq/Pres Penalties
+
Top N-Sigma
diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index cbdfc0a5a..c1813f2e7 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -806,7 +806,7 @@ jQuery(function () { 'dry_penalty_last_n_textgenerationwebui': 0, 'xtc_threshold_textgenerationwebui': 0.1, 'xtc_probability_textgenerationwebui': 0, - 'nsigma_textgenerationwebui': [LLAMACPP].includes(settings.type) ? -0.01 : 0, + 'nsigma_textgenerationwebui': 0, 'min_keep_textgenerationwebui': 0, }; @@ -1335,8 +1335,8 @@ export async function getTextGenGenerationData(finalPrompt, maxTokens, isImperso 'sampler_order': settings.type === textgen_types.KOBOLDCPP ? settings.sampler_order : undefined, 'xtc_threshold': settings.xtc_threshold, 'xtc_probability': settings.xtc_probability, - 'nsigma': settings.nsigma, - 'top_n_sigma': settings.nsigma, + 'nsigma': [LLAMACPP].includes(settings.type) && settings.nsigma === 0 ? -1 : settings.nsigma, + 'top_n_sigma': [LLAMACPP].includes(settings.type) && settings.nsigma === 0 ? -1 : settings.nsigma, 'min_keep': settings.min_keep, }; const nonAphroditeParams = { From 3be991591fa4d07e1546b9bbc34c00753aa0a40a Mon Sep 17 00:00:00 2001 From: DocShotgun <126566557+DocShotgun@users.noreply.github.com> Date: Tue, 6 May 2025 14:11:00 -0700 Subject: [PATCH 4/4] Remove special handling of nsigma for llama.cpp * 0 now changed to disable/no-op upstream --- public/scripts/textgen-settings.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index c1813f2e7..69f6372fb 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -1335,8 +1335,8 @@ export async function getTextGenGenerationData(finalPrompt, maxTokens, isImperso 'sampler_order': settings.type === textgen_types.KOBOLDCPP ? settings.sampler_order : undefined, 'xtc_threshold': settings.xtc_threshold, 'xtc_probability': settings.xtc_probability, - 'nsigma': [LLAMACPP].includes(settings.type) && settings.nsigma === 0 ? -1 : settings.nsigma, - 'top_n_sigma': [LLAMACPP].includes(settings.type) && settings.nsigma === 0 ? -1 : settings.nsigma, + 'nsigma': settings.nsigma, + 'top_n_sigma': settings.nsigma, 'min_keep': settings.min_keep, }; const nonAphroditeParams = {