Spaces:
Runtime error
Runtime error
Advanced generation options (#30)
Browse filesFiles changed (2)
1234567828 unmodified lines373839404142<script lang="ts">import { GENERATION_CONFIG_KEYS, GENERATION_CONFIG_SETTINGS } from './generationConfigSettings';export let config;export let streaming;export let classNames = '';</script>28 unmodified lines</div>{/each}<div class="mt-2"><label class="flex cursor-pointer items-center justify-between"><input type="checkbox" bind:checked={streaming} class="peer sr-only" />12345678910111228 unmodified lines41424344454647484950515253545556575859606162636465666768697071727374757677787980818283<script lang="ts">import {GENERATION_CONFIG_KEYS,GENERATION_CONFIG_KEYS_ADVANCED,GENERATION_CONFIG_SETTINGS} from './generationConfigSettings';export let config;export let streaming: boolean;export let classNames = '';</script>28 unmodified lines</div>{/each}<details><summary>Advanced Options</summary><div class="mt-4 flex flex-col gap-y-5">{#each GENERATION_CONFIG_KEYS_ADVANCED as key}{@const settings = GENERATION_CONFIG_SETTINGS[key]}<div><div class="flex items-center justify-between"><labelfor="temperature-range"class="mb-2 block text-sm font-medium text-gray-900 dark:text-white">{settings.label}</label><inputtype="number"class="w-16 rounded border bg-transparent px-1 py-0.5 text-right text-sm dark:border-gray-700"min={settings.min}max={settings.max}step={settings.step}value={config[key] ?? settings.default}on:input={(e) => (config[key] = e.currentTarget.value)}/></div><inputid="temperature-range"type="range"min={settings.min}max={settings.max}step={settings.step}value={config[key] ?? settings.default}on:input={(e) => (config[key] = e.currentTarget.value)}class="h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-200 accent-black dark:bg-gray-700 dark:accent-blue-500"/></div>{/each}</div></details><div class="mt-2"><label class="flex cursor-pointer items-center justify-between"><input type="checkbox" bind:checked={streaming} class="peer sr-only" />
45 unmodified lines4647484950515253545556575859606145 unmodified linesexport type GenerationConfigKey = keyof typeof GENERATION_CONFIG_SETTINGS;export const GENERATION_CONFIG_KEYS: GenerationConfigKey[] = Object.keys(GENERATION_CONFIG_SETTINGS);export type GenerationConfig = Record<GenerationConfigKey, number>;export const defaultGenerationConfig = Object.keys(GENERATION_CONFIG_SETTINGS).reduce((acc, key) => {acc[key] = GENERATION_CONFIG_SETTINGS[key].default;return acc;},{} as GenerationConfig);45 unmodified lines464748495051525354555657585960616245 unmodified linesexport type GenerationConfigKey = keyof typeof GENERATION_CONFIG_SETTINGS;export const GENERATION_CONFIG_KEYS: GenerationConfigKey[] = ['temperature', 'max_tokens'];export const GENERATION_CONFIG_KEYS_ADVANCED: GenerationConfigKey[] = ['top_p','top_k','repetition_penalty'];export type GenerationConfig = Record<GenerationConfigKey, number>;export const defaultGenerationConfig = GENERATION_CONFIG_KEYS.reduce((acc, key) => {acc[key] = GENERATION_CONFIG_SETTINGS[key].default;return acc;}, {} as GenerationConfig);
src/lib/components/InferencePlayground/InferencePlaygroundGenerationConfig.svelte+43-2
src/lib/components/InferencePlayground/generationConfigSettings.ts+11-10