mishig HF staff commited on
Commit
7e29a25
1 Parent(s): 86359b7

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 settings = GENERATION_CONFIG_SETTINGS[key]}
 
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
- min={settings.min}
27
- max={settings.max}
28
- step={settings.step}
29
  bind:value={config[key]}
30
  />
31
  </div>
32
  <input
33
  id="temperature-range"
34
  type="range"
35
- min={settings.min}
36
- max={settings.max}
37
- step={settings.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
  />
 
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
  />