Dynamic max tokens
Browse files
src/lib/components/InferencePlayground/InferencePlaygroundGenerationConfig.svelte
CHANGED
@@ -12,29 +12,29 @@
|
|
12 |
|
13 |
<div class="flex flex-col gap-y-5 {classNames}">
|
14 |
{#each GENERATION_CONFIG_KEYS as key}
|
15 |
-
{@const
|
|
|
16 |
<div>
|
17 |
<div class="flex items-center justify-between">
|
18 |
<label
|
19 |
for="temperature-range"
|
20 |
-
class="mb-2 block text-sm font-medium text-gray-900 dark:text-white"
|
21 |
-
>{settings.label}</label
|
22 |
>
|
23 |
<input
|
24 |
type="number"
|
25 |
class="w-16 rounded border bg-transparent px-1 py-0.5 text-right text-sm dark:border-gray-700"
|
26 |
-
|
27 |
-
max={
|
28 |
-
|
29 |
bind:value={config[key]}
|
30 |
/>
|
31 |
</div>
|
32 |
<input
|
33 |
id="temperature-range"
|
34 |
type="range"
|
35 |
-
|
36 |
-
max={
|
37 |
-
|
38 |
bind:value={config[key]}
|
39 |
class="h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-200 accent-black dark:bg-gray-700 dark:accent-blue-500"
|
40 |
/>
|
|
|
12 |
|
13 |
<div class="flex flex-col gap-y-5 {classNames}">
|
14 |
{#each GENERATION_CONFIG_KEYS as key}
|
15 |
+
{@const { label, min, step } = GENERATION_CONFIG_SETTINGS[key]}
|
16 |
+
{@const max = key === 'max_tokens' ? 1000 : GENERATION_CONFIG_SETTINGS[key].max}
|
17 |
<div>
|
18 |
<div class="flex items-center justify-between">
|
19 |
<label
|
20 |
for="temperature-range"
|
21 |
+
class="mb-2 block text-sm font-medium text-gray-900 dark:text-white">{label}</label
|
|
|
22 |
>
|
23 |
<input
|
24 |
type="number"
|
25 |
class="w-16 rounded border bg-transparent px-1 py-0.5 text-right text-sm dark:border-gray-700"
|
26 |
+
{min}
|
27 |
+
max={key === 'max_tokens' ? 1000 : max}
|
28 |
+
{step}
|
29 |
bind:value={config[key]}
|
30 |
/>
|
31 |
</div>
|
32 |
<input
|
33 |
id="temperature-range"
|
34 |
type="range"
|
35 |
+
{min}
|
36 |
+
max={key === 'max_tokens' ? 1000 : max}
|
37 |
+
{step}
|
38 |
bind:value={config[key]}
|
39 |
class="h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-200 accent-black dark:bg-gray-700 dark:accent-blue-500"
|
40 |
/>
|