summaryrefslogtreecommitdiff
path: root/examples/server/webui/src
diff options
context:
space:
mode:
authorfirecoperana <xuqiaowei1124@gmail.com>2025-06-12 00:19:26 -0500
committerGitHub <noreply@github.com>2025-06-12 08:19:26 +0300
commit7b1a3eece7e33ce197324f44e839dec430162108 (patch)
tree77762570e9f34119063de54c6c9af09c9e917611 /examples/server/webui/src
parent4fc3cb4a4709e747984f7b8c9097d9b997d949b5 (diff)
Add top n sigma sampler and other webui fix (#512)
Co-authored-by: firecoperana <firecoperana>
Diffstat (limited to 'examples/server/webui/src')
-rw-r--r--examples/server/webui/src/Config.ts7
-rw-r--r--examples/server/webui/src/components/Header.tsx2
-rw-r--r--examples/server/webui/src/components/SettingDialog.tsx19
-rw-r--r--examples/server/webui/src/utils/app.context.tsx1
4 files changed, 17 insertions, 12 deletions
diff --git a/examples/server/webui/src/Config.ts b/examples/server/webui/src/Config.ts
index f40ed30c..35411def 100644
--- a/examples/server/webui/src/Config.ts
+++ b/examples/server/webui/src/Config.ts
@@ -17,7 +17,7 @@ export const CONFIG_DEFAULT = {
showThoughtInProgress: false,
excludeThoughtOnReq: true,
// make sure these default values are in sync with `common.h`
- samplers: 'dkypmxt',
+ samplers: 'dkypmxnt',
temperature: 0.8,
dynatemp_range: 0.0,
dynatemp_exponent: 1.0,
@@ -26,6 +26,7 @@ export const CONFIG_DEFAULT = {
min_p: 0.05,
xtc_probability: 0.0,
xtc_threshold: 0.1,
+ top_n_sigma: 0.0,
typical_p: 1.0,
repeat_last_n: 64,
repeat_penalty: 1.0,
@@ -44,7 +45,7 @@ export const CONFIG_INFO: Record<string, string> = {
apiKey: 'Set the API Key if you are using --api-key option for the server.',
systemMessage: 'The starting message that defines how model should behave.',
samplers:
- 'The order at which samplers are applied, in simplified way. Default is "dkypmxt": dry->top_k->typ_p->top_p->min_p->xtc->temperature',
+ 'The order at which samplers are applied, in simplified way. Default is "dkypmxt": dry->top_k->typ_p->top_p->min_p->xtc->top_sigma->temperature',
temperature:
'Controls the randomness of the generated text by affecting the probability distribution of the output tokens. Higher = more random, lower = more focused.',
dynatemp_range:
@@ -60,6 +61,8 @@ export const CONFIG_INFO: Record<string, string> = {
'XTC sampler cuts out top tokens; this parameter controls the chance of cutting tokens at all. 0 disables XTC.',
xtc_threshold:
'XTC sampler cuts out top tokens; this parameter controls the token probability that is required to cut that token.',
+ top_n_sigma:
+ 'Top-n-sigma sampling filters out low-value tokens by discarding tokens that fall more than n standard deviations below the maximum probability',
typical_p:
'Sorts and limits tokens based on the difference between log-probability and entropy.',
repeat_last_n: 'Last n tokens to consider for penalizing repetition',
diff --git a/examples/server/webui/src/components/Header.tsx b/examples/server/webui/src/components/Header.tsx
index 4c6b291e..84fea191 100644
--- a/examples/server/webui/src/components/Header.tsx
+++ b/examples/server/webui/src/components/Header.tsx
@@ -70,7 +70,7 @@ export default function Header() {
</svg>
</label>
- <div className="grow text-2xl font-bold ml-2">llama.cpp</div>
+ <div className="grow text-2xl font-bold ml-2">ik_llama.cpp</div>
{/* action buttons (top right) */}
<div className="flex items-center">
diff --git a/examples/server/webui/src/components/SettingDialog.tsx b/examples/server/webui/src/components/SettingDialog.tsx
index b65e73ae..cd091a55 100644
--- a/examples/server/webui/src/components/SettingDialog.tsx
+++ b/examples/server/webui/src/components/SettingDialog.tsx
@@ -29,6 +29,7 @@ const SAMPLER_KEYS: SettKey[] = [
'typical_p',
'xtc_probability',
'xtc_threshold',
+ 'top_n_sigma'
];
const PENALTY_KEYS: SettKey[] = [
'repeat_last_n',
@@ -196,7 +197,7 @@ const SETTING_SECTIONS: SettingSection[] = [
label: (
<>
Custom JSON config (For more info, refer to{' '}
- <OpenInNewTab href="https://github.com/ggerganov/llama.cpp/blob/master/examples/server/README.md">
+ <OpenInNewTab href="https://github.com/ikawrakow/ik_llama.cpp/tree/main/examples/server/README.md">
server documentation
</OpenInNewTab>
)
@@ -224,7 +225,7 @@ const SETTING_SECTIONS: SettingSection[] = [
<br />
<br />
If you encounter any problems, create a{' '}
- <OpenInNewTab href="https://github.com/ggerganov/llama.cpp/issues/new?template=019-bug-misc.yml">
+ <OpenInNewTab href="https://github.com/ikawrakow/ik_llama.cpp/issues/new?template=019-bug-misc.yml">
Bug (misc.)
</OpenInNewTab>{' '}
report on Github. Please also specify <b>webui/experimental</b> on
@@ -456,11 +457,11 @@ function SettingsModalLongInput({
<div className="label inline">{label || configKey}</div>
<textarea
className="textarea textarea-bordered h-24"
- placeholder={`Default: ${CONFIG_DEFAULT[configKey] || 'none'}`}
- value={value}
- onChange={(e) => onChange(e.target.value)}
- />
- </label>
+ placeholder={`Default: ${CONFIG_DEFAULT[configKey] || 'none'}`}
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ />
+ </label>
);
}
@@ -485,7 +486,7 @@ function SettingsModalShortInput({
<div className="block md:hidden mb-1">
<b>{label || configKey}</b>
<br />
- <p className="text-xs">{helpMsg}</p>
+ <p className="text-xs whitespace-normal">{helpMsg}</p>
</div>
)}
<label className="input input-bordered join-item grow flex items-center gap-2 mb-2">
@@ -494,7 +495,7 @@ function SettingsModalShortInput({
{label || configKey}
</div>
{helpMsg && (
- <div className="dropdown-content menu bg-base-100 rounded-box z-10 w-64 p-2 shadow mt-4">
+ <div className="dropdown-content menu bg-base-100 rounded-box z-10 w-64 p-2 shadow mt-4 whitespace-normal break-words">
{helpMsg}
</div>
)}
diff --git a/examples/server/webui/src/utils/app.context.tsx b/examples/server/webui/src/utils/app.context.tsx
index 378e24dd..ce81fccd 100644
--- a/examples/server/webui/src/utils/app.context.tsx
+++ b/examples/server/webui/src/utils/app.context.tsx
@@ -200,6 +200,7 @@ export const AppContextProvider = ({
typical_p: config.typical_p,
xtc_probability: config.xtc_probability,
xtc_threshold: config.xtc_threshold,
+ top_n_sigma: config.top_n_sigma,
repeat_last_n: config.repeat_last_n,
repeat_penalty: config.repeat_penalty,
presence_penalty: config.presence_penalty,