Commit 547b9900 authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

refac: params

parent fcf8f2a7
...@@ -5,21 +5,23 @@ ...@@ -5,21 +5,23 @@
const i18n = getContext('i18n'); const i18n = getContext('i18n');
export let admin = false;
export let params = { export let params = {
// Advanced // Advanced
seed: 0, seed: null,
stop: null, stop: null,
temperature: '', temperature: null,
frequency_penalty: '', frequency_penalty: null,
repeat_last_n: '', repeat_last_n: null,
mirostat: '', mirostat: null,
mirostat_eta: '', mirostat_eta: null,
mirostat_tau: '', mirostat_tau: null,
top_k: '', top_k: null,
top_p: '', top_p: null,
tfs_z: '', tfs_z: null,
num_ctx: '', num_ctx: null,
max_tokens: '', max_tokens: null,
use_mmap: null, use_mmap: null,
use_mlock: null, use_mlock: null,
num_thread: null, num_thread: null,
...@@ -112,10 +114,10 @@ ...@@ -112,10 +114,10 @@
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
type="button" type="button"
on:click={() => { on:click={() => {
params.temperature = (params?.temperature ?? '') === '' ? 0.8 : ''; params.temperature = (params?.temperature ?? null) === null ? 0.8 : null;
}} }}
> >
{#if (params?.temperature ?? '') === ''} {#if (params?.temperature ?? null) === null}
<span class="ml-2 self-center"> {$i18n.t('Default')} </span> <span class="ml-2 self-center"> {$i18n.t('Default')} </span>
{:else} {:else}
<span class="ml-2 self-center"> {$i18n.t('Custom')} </span> <span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
...@@ -123,7 +125,7 @@ ...@@ -123,7 +125,7 @@
</button> </button>
</div> </div>
{#if (params?.temperature ?? '') !== ''} {#if (params?.temperature ?? null) !== null}
<div class="flex mt-0.5 space-x-2"> <div class="flex mt-0.5 space-x-2">
<div class=" flex-1"> <div class=" flex-1">
<input <input
...@@ -157,10 +159,10 @@ ...@@ -157,10 +159,10 @@
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
type="button" type="button"
on:click={() => { on:click={() => {
params.mirostat = (params?.mirostat ?? '') === '' ? 0 : ''; params.mirostat = (params?.mirostat ?? null) === null ? 0 : null;
}} }}
> >
{#if (params?.mirostat ?? '') === ''} {#if (params?.mirostat ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span> <span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else} {:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span> <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
...@@ -168,7 +170,7 @@ ...@@ -168,7 +170,7 @@
</button> </button>
</div> </div>
{#if (params?.mirostat ?? '') !== ''} {#if (params?.mirostat ?? null) !== null}
<div class="flex mt-0.5 space-x-2"> <div class="flex mt-0.5 space-x-2">
<div class=" flex-1"> <div class=" flex-1">
<input <input
...@@ -203,10 +205,10 @@ ...@@ -203,10 +205,10 @@
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
type="button" type="button"
on:click={() => { on:click={() => {
params.mirostat_eta = (params?.mirostat_eta ?? '') === '' ? 0.1 : ''; params.mirostat_eta = (params?.mirostat_eta ?? null) === null ? 0.1 : null;
}} }}
> >
{#if (params?.mirostat_eta ?? '') === ''} {#if (params?.mirostat_eta ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span> <span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else} {:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span> <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
...@@ -214,7 +216,7 @@ ...@@ -214,7 +216,7 @@
</button> </button>
</div> </div>
{#if (params?.mirostat_eta ?? '') !== ''} {#if (params?.mirostat_eta ?? null) !== null}
<div class="flex mt-0.5 space-x-2"> <div class="flex mt-0.5 space-x-2">
<div class=" flex-1"> <div class=" flex-1">
<input <input
...@@ -248,10 +250,10 @@ ...@@ -248,10 +250,10 @@
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
type="button" type="button"
on:click={() => { on:click={() => {
params.mirostat_tau = (params?.mirostat_tau ?? '') === '' ? 5.0 : ''; params.mirostat_tau = (params?.mirostat_tau ?? null) === null ? 5.0 : null;
}} }}
> >
{#if (params?.mirostat_tau ?? '') === ''} {#if (params?.mirostat_tau ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span> <span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else} {:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span> <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
...@@ -259,7 +261,7 @@ ...@@ -259,7 +261,7 @@
</button> </button>
</div> </div>
{#if (params?.mirostat_tau ?? '') !== ''} {#if (params?.mirostat_tau ?? null) !== null}
<div class="flex mt-0.5 space-x-2"> <div class="flex mt-0.5 space-x-2">
<div class=" flex-1"> <div class=" flex-1">
<input <input
...@@ -293,10 +295,10 @@ ...@@ -293,10 +295,10 @@
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
type="button" type="button"
on:click={() => { on:click={() => {
params.top_k = (params?.top_k ?? '') === '' ? 40 : ''; params.top_k = (params?.top_k ?? null) === null ? 40 : null;
}} }}
> >
{#if (params?.top_k ?? '') === ''} {#if (params?.top_k ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span> <span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else} {:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span> <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
...@@ -304,7 +306,7 @@ ...@@ -304,7 +306,7 @@
</button> </button>
</div> </div>
{#if (params?.top_k ?? '') !== ''} {#if (params?.top_k ?? null) !== null}
<div class="flex mt-0.5 space-x-2"> <div class="flex mt-0.5 space-x-2">
<div class=" flex-1"> <div class=" flex-1">
<input <input
...@@ -338,10 +340,10 @@ ...@@ -338,10 +340,10 @@
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
type="button" type="button"
on:click={() => { on:click={() => {
params.top_p = (params?.top_p ?? '') === '' ? 0.9 : ''; params.top_p = (params?.top_p ?? null) === null ? 0.9 : null;
}} }}
> >
{#if (params?.top_p ?? '') === ''} {#if (params?.top_p ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span> <span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else} {:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span> <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
...@@ -349,7 +351,7 @@ ...@@ -349,7 +351,7 @@
</button> </button>
</div> </div>
{#if (params?.top_p ?? '') !== ''} {#if (params?.top_p ?? null) !== null}
<div class="flex mt-0.5 space-x-2"> <div class="flex mt-0.5 space-x-2">
<div class=" flex-1"> <div class=" flex-1">
<input <input
...@@ -383,10 +385,10 @@ ...@@ -383,10 +385,10 @@
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
type="button" type="button"
on:click={() => { on:click={() => {
params.frequency_penalty = (params?.frequency_penalty ?? '') === '' ? 1.1 : ''; params.frequency_penalty = (params?.frequency_penalty ?? null) === null ? 1.1 : null;
}} }}
> >
{#if (params?.frequency_penalty ?? '') === ''} {#if (params?.frequency_penalty ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span> <span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else} {:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span> <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
...@@ -394,7 +396,7 @@ ...@@ -394,7 +396,7 @@
</button> </button>
</div> </div>
{#if (params?.frequency_penalty ?? '') !== ''} {#if (params?.frequency_penalty ?? null) !== null}
<div class="flex mt-0.5 space-x-2"> <div class="flex mt-0.5 space-x-2">
<div class=" flex-1"> <div class=" flex-1">
<input <input
...@@ -428,10 +430,10 @@ ...@@ -428,10 +430,10 @@
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
type="button" type="button"
on:click={() => { on:click={() => {
params.repeat_last_n = (params?.repeat_last_n ?? '') === '' ? 64 : ''; params.repeat_last_n = (params?.repeat_last_n ?? null) === null ? 64 : null;
}} }}
> >
{#if (params?.repeat_last_n ?? '') === ''} {#if (params?.repeat_last_n ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span> <span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else} {:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span> <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
...@@ -439,7 +441,7 @@ ...@@ -439,7 +441,7 @@
</button> </button>
</div> </div>
{#if (params?.repeat_last_n ?? '') !== ''} {#if (params?.repeat_last_n ?? null) !== null}
<div class="flex mt-0.5 space-x-2"> <div class="flex mt-0.5 space-x-2">
<div class=" flex-1"> <div class=" flex-1">
<input <input
...@@ -474,10 +476,10 @@ ...@@ -474,10 +476,10 @@
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
type="button" type="button"
on:click={() => { on:click={() => {
params.tfs_z = (params?.tfs_z ?? '') === '' ? 1 : ''; params.tfs_z = (params?.tfs_z ?? null) === null ? 1 : null;
}} }}
> >
{#if (params?.tfs_z ?? '') === ''} {#if (params?.tfs_z ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span> <span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else} {:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span> <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
...@@ -485,7 +487,7 @@ ...@@ -485,7 +487,7 @@
</button> </button>
</div> </div>
{#if (params?.tfs_z ?? '') !== ''} {#if (params?.tfs_z ?? null) !== null}
<div class="flex mt-0.5 space-x-2"> <div class="flex mt-0.5 space-x-2">
<div class=" flex-1"> <div class=" flex-1">
<input <input
...@@ -519,10 +521,10 @@ ...@@ -519,10 +521,10 @@
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
type="button" type="button"
on:click={() => { on:click={() => {
params.num_ctx = (params?.num_ctx ?? '') === '' ? 2048 : ''; params.num_ctx = (params?.num_ctx ?? null) === null ? 2048 : null;
}} }}
> >
{#if (params?.num_ctx ?? '') === ''} {#if (params?.num_ctx ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span> <span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else} {:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span> <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
...@@ -530,7 +532,7 @@ ...@@ -530,7 +532,7 @@
</button> </button>
</div> </div>
{#if (params?.num_ctx ?? '') !== ''} {#if (params?.num_ctx ?? null) !== null}
<div class="flex mt-0.5 space-x-2"> <div class="flex mt-0.5 space-x-2">
<div class=" flex-1"> <div class=" flex-1">
<input <input
...@@ -564,10 +566,10 @@ ...@@ -564,10 +566,10 @@
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
type="button" type="button"
on:click={() => { on:click={() => {
params.max_tokens = (params?.max_tokens ?? '') === '' ? 128 : ''; params.max_tokens = (params?.max_tokens ?? null) === null ? 128 : null;
}} }}
> >
{#if (params?.max_tokens ?? '') === ''} {#if (params?.max_tokens ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span> <span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else} {:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span> <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
...@@ -575,7 +577,7 @@ ...@@ -575,7 +577,7 @@
</button> </button>
</div> </div>
{#if (params?.max_tokens ?? '') !== ''} {#if (params?.max_tokens ?? null) !== null}
<div class="flex mt-0.5 space-x-2"> <div class="flex mt-0.5 space-x-2">
<div class=" flex-1"> <div class=" flex-1">
<input <input
...@@ -602,122 +604,124 @@ ...@@ -602,122 +604,124 @@
{/if} {/if}
</div> </div>
<div class=" py-0.5 w-full justify-between"> {#if admin}
<div class="flex w-full justify-between"> <div class=" py-0.5 w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('use_mmap (Ollama)')}</div> <div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('use_mmap (Ollama)')}</div>
<button
class="p-1 px-3 text-xs flex rounded transition" <button
type="button" class="p-1 px-3 text-xs flex rounded transition"
on:click={() => { type="button"
params.use_mmap = (params?.use_mmap ?? null) === null ? true : null; on:click={() => {
}} params.use_mmap = (params?.use_mmap ?? null) === null ? true : null;
> }}
{#if (params?.use_mmap ?? null) === null} >
<span class="ml-2 self-center">{$i18n.t('Default')}</span> {#if (params?.use_mmap ?? null) === null}
{:else} <span class="ml-2 self-center">{$i18n.t('Default')}</span>
<span class="ml-2 self-center">{$i18n.t('On')}</span> {:else}
{/if} <span class="ml-2 self-center">{$i18n.t('On')}</span>
</button> {/if}
</button>
</div>
</div> </div>
</div>
<div class=" py-0.5 w-full justify-between"> <div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between"> <div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('use_mlock (Ollama)')}</div> <div class=" self-center text-xs font-medium">{$i18n.t('use_mlock (Ollama)')}</div>
<button <button
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
type="button" type="button"
on:click={() => { on:click={() => {
params.use_mlock = (params?.use_mlock ?? null) === null ? true : null; params.use_mlock = (params?.use_mlock ?? null) === null ? true : null;
}} }}
> >
{#if (params?.use_mlock ?? null) === null} {#if (params?.use_mlock ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span> <span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else} {:else}
<span class="ml-2 self-center">{$i18n.t('On')}</span> <span class="ml-2 self-center">{$i18n.t('On')}</span>
{/if} {/if}
</button> </button>
</div>
</div> </div>
</div>
<div class=" py-0.5 w-full justify-between"> <div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between"> <div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('num_thread (Ollama)')}</div> <div class=" self-center text-xs font-medium">{$i18n.t('num_thread (Ollama)')}</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
params.num_thread = (params?.num_thread ?? null) === null ? 2 : null;
}}
>
{#if (params?.num_thread ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
{/if}
</button>
</div>
<button {#if (params?.num_thread ?? null) !== null}
class="p-1 px-3 text-xs flex rounded transition" <div class="flex mt-0.5 space-x-2">
type="button" <div class=" flex-1">
on:click={() => { <input
params.num_thread = (params?.num_thread ?? null) === null ? 2 : null; id="steps-range"
}} type="range"
> min="1"
{#if (params?.num_thread ?? null) === null} max="256"
<span class="ml-2 self-center">{$i18n.t('Default')}</span> step="1"
{:else} bind:value={params.num_thread}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span> class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
{/if} />
</button> </div>
<div class="">
<input
bind:value={params.num_thread}
type="number"
class=" bg-transparent text-center w-14"
min="1"
max="256"
step="1"
/>
</div>
</div>
{/if}
</div> </div>
{#if (params?.num_thread ?? null) !== null} <!-- <div class=" py-0.5 w-full justify-between">
<div class="flex mt-0.5 space-x-2"> <div class="flex w-full justify-between">
<div class=" flex-1"> <div class=" self-center text-xs font-medium">{$i18n.t('Template')}</div>
<input
id="steps-range" <button
type="range" class="p-1 px-3 text-xs flex rounded transition"
min="1" type="button"
max="256" on:click={() => {
step="1" params.template = (params?.template ?? null) === null ? '' : null;
bind:value={params.num_thread} }}
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700" >
/> {#if (params?.template ?? null) === null}
</div> <span class="ml-2 self-center">{$i18n.t('Default')}</span>
<div class=""> {:else}
<input <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
bind:value={params.num_thread} {/if}
type="number" </button>
class=" bg-transparent text-center w-14"
min="1"
max="256"
step="1"
/>
</div>
</div> </div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between"> {#if (params?.template ?? null) !== null}
<div class="flex w-full justify-between"> <div class="flex mt-0.5 space-x-2">
<div class=" self-center text-xs font-medium">{$i18n.t('Template')}</div> <div class=" flex-1">
<textarea
<button class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg -mb-1"
class="p-1 px-3 text-xs flex rounded transition" placeholder="Write your model template content here"
type="button" rows="4"
on:click={() => { bind:value={params.template}
params.template = (params?.template ?? null) === null ? '' : null; />
}} </div>
>
{#if (params?.template ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
{/if}
</button>
</div>
{#if (params?.template ?? null) !== null}
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<textarea
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg -mb-1"
placeholder="Write your model template content here"
rows="4"
bind:value={params.template}
/>
</div> </div>
</div> {/if}
{/if} </div> -->
</div> {/if}
</div> </div>
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import { getLanguages } from '$lib/i18n'; import { getLanguages } from '$lib/i18n';
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
import { models, settings, theme } from '$lib/stores'; import { models, settings, theme, user } from '$lib/stores';
const i18n = getContext('i18n'); const i18n = getContext('i18n');
...@@ -43,19 +43,19 @@ ...@@ -43,19 +43,19 @@
let params = { let params = {
// Advanced // Advanced
seed: 0, seed: null,
temperature: '', temperature: null,
frequency_penalty: '', frequency_penalty: null,
repeat_last_n: '', repeat_last_n: null,
mirostat: '', mirostat: null,
mirostat_eta: '', mirostat_eta: null,
mirostat_tau: '', mirostat_tau: null,
top_k: '', top_k: null,
top_p: '', top_p: null,
stop: null, stop: null,
tfs_z: '', tfs_z: null,
num_ctx: '', num_ctx: null,
max_tokens: '' max_tokens: null
}; };
const toggleRequestFormat = async () => { const toggleRequestFormat = async () => {
...@@ -79,12 +79,6 @@ ...@@ -79,12 +79,6 @@
requestFormat = $settings.requestFormat ?? ''; requestFormat = $settings.requestFormat ?? '';
keepAlive = $settings.keepAlive ?? null; keepAlive = $settings.keepAlive ?? null;
params.seed = $settings.seed ?? 0;
params.temperature = $settings.temperature ?? '';
params.frequency_penalty = $settings.frequency_penalty ?? '';
params.top_k = $settings.top_k ?? '';
params.top_p = $settings.top_p ?? '';
params.num_ctx = $settings.num_ctx ?? '';
params = { ...params, ...$settings.params }; params = { ...params, ...$settings.params };
params.stop = $settings?.params?.stop ? ($settings?.params?.stop ?? []).join(',') : null; params.stop = $settings?.params?.stop ? ($settings?.params?.stop ?? []).join(',') : null;
}); });
...@@ -227,7 +221,7 @@ ...@@ -227,7 +221,7 @@
</div> </div>
{#if showAdvanced} {#if showAdvanced}
<AdvancedParams bind:params /> <AdvancedParams admin={$user?.role === 'admin'} bind:params />
<hr class=" dark:border-gray-850" /> <hr class=" dark:border-gray-850" />
<div class=" py-1 w-full justify-between"> <div class=" py-1 w-full justify-between">
...@@ -300,20 +294,23 @@ ...@@ -300,20 +294,23 @@
saveSettings({ saveSettings({
system: system !== '' ? system : undefined, system: system !== '' ? system : undefined,
params: { params: {
seed: (params.seed !== 0 ? params.seed : undefined) ?? undefined, seed: (params.seed !== null ? params.seed : undefined) ?? undefined,
stop: params.stop ? params.stop.split(',').filter((e) => e) : undefined, stop: params.stop ? params.stop.split(',').filter((e) => e) : undefined,
temperature: params.temperature !== '' ? params.temperature : undefined, temperature: params.temperature !== null ? params.temperature : undefined,
frequency_penalty: frequency_penalty:
params.frequency_penalty !== '' ? params.frequency_penalty : undefined, params.frequency_penalty !== null ? params.frequency_penalty : undefined,
repeat_last_n: params.repeat_last_n !== '' ? params.repeat_last_n : undefined, repeat_last_n: params.repeat_last_n !== null ? params.repeat_last_n : undefined,
mirostat: params.mirostat !== '' ? params.mirostat : undefined, mirostat: params.mirostat !== null ? params.mirostat : undefined,
mirostat_eta: params.mirostat_eta !== '' ? params.mirostat_eta : undefined, mirostat_eta: params.mirostat_eta !== null ? params.mirostat_eta : undefined,
mirostat_tau: params.mirostat_tau !== '' ? params.mirostat_tau : undefined, mirostat_tau: params.mirostat_tau !== null ? params.mirostat_tau : undefined,
top_k: params.top_k !== '' ? params.top_k : undefined, top_k: params.top_k !== null ? params.top_k : undefined,
top_p: params.top_p !== '' ? params.top_p : undefined, top_p: params.top_p !== null ? params.top_p : undefined,
tfs_z: params.tfs_z !== '' ? params.tfs_z : undefined, tfs_z: params.tfs_z !== null ? params.tfs_z : undefined,
num_ctx: params.num_ctx !== '' ? params.num_ctx : undefined, num_ctx: params.num_ctx !== null ? params.num_ctx : undefined,
max_tokens: params.max_tokens !== '' ? params.max_tokens : undefined max_tokens: params.max_tokens !== null ? params.max_tokens : undefined,
use_mmap: params.use_mmap !== null ? params.use_mmap : undefined,
use_mlock: params.use_mlock !== null ? params.use_mlock : undefined
num_thread: params.num_thread !== null ? params.num_thread : undefined
}, },
keepAlive: keepAlive ? (isNaN(keepAlive) ? keepAlive : parseInt(keepAlive)) : undefined keepAlive: keepAlive ? (isNaN(keepAlive) ? keepAlive : parseInt(keepAlive)) : undefined
}); });
......
...@@ -445,6 +445,7 @@ ...@@ -445,6 +445,7 @@
{#if showAdvanced} {#if showAdvanced}
<div class="my-2"> <div class="my-2">
<AdvancedParams <AdvancedParams
admin={true}
bind:params bind:params
on:change={(e) => { on:change={(e) => {
info.params = { ...info.params, ...params }; info.params = { ...info.params, ...params };
......
...@@ -408,6 +408,7 @@ ...@@ -408,6 +408,7 @@
{#if showAdvanced} {#if showAdvanced}
<div class="my-2"> <div class="my-2">
<AdvancedParams <AdvancedParams
admin={true}
bind:params bind:params
on:change={(e) => { on:change={(e) => {
info.params = { ...info.params, ...params }; info.params = { ...info.params, ...params };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment