Spaces:
Runtime error
Runtime error
Max tokens (#32)
Browse filesFiles changed (3)
364 unmodified lines365366367368369370371368369370371364 unmodified lines </select> </div>
<PlaygroundOptions bind:config={conversations[0].config} bind:streaming={conversations[0].streaming} /> <PlaygroundOptions bind:conversation={conversations[0]} /> <div class="mt-auto"> <div class="mb-3 flex items-center justify-between gap-2"> <label3 unmodified lines45678991011121352 unmodified lines6667686869697071723 unmodified lines import Message from './InferencePlaygroundMessage.svelte'; import PlaygroundOptions from './InferencePlaygroundGenerationConfig.svelte'; import IconPlus from '../Icons/IconPlus.svelte'; import type { Conversation } from '$lib/types';
export let loading; export let conversation; export let conversation: Conversation; export let index; export let viewCode; export let sideBySide = false;52 unmodified lines /></svg > <PlaygroundOptions bind:config={conversation.config} bind:streaming={conversation.streaming} bind:conversation classNames="absolute top-8 right-0 w-56 invisible group-focus:visible hover:visible border border-gray-200/80 bg-white z-10 px-4 py-6 text-sm shadow-sm dark:border-gray-800 dark:bg-gray-800 rounded-xl" /> </button>123456788991011121314151617151819202122232021242526272826272829293031323334353637353637383839404142434417 unmodified lines626364626365666768692 unmodified lines727374727375767778793 unmodified lines8384858386878889<script lang="ts"> import type { Conversation } from '$lib/types'; import { GENERATION_CONFIG_KEYS, GENERATION_CONFIG_KEYS_ADVANCED, GENERATION_CONFIG_SETTINGS } from './generationConfigSettings';
export let config; export let streaming: boolean; export let conversation: Conversation; export let classNames = '';
$: modelMaxLength = conversation.model.tokenizerConfig.model_max_length; $: maxTokens = Math.min(modelMaxLength ?? GENERATION_CONFIG_SETTINGS['max_tokens'].max, 64_000);</script>
<div class="flex flex-col gap-y-5 {classNames}"> {#each GENERATION_CONFIG_KEYS as key} {@const settings = GENERATION_CONFIG_SETTINGS[key]} {@const { label, min, step } = GENERATION_CONFIG_SETTINGS[key]} {@const max = key === 'max_tokens' ? maxTokens : GENERATION_CONFIG_SETTINGS[key].max} <div> <div class="flex items-center justify-between"> <label for="temperature-range" class="mb-2 block text-sm font-medium text-gray-900 dark:text-white" >{settings.label}</label class="mb-2 block text-sm font-medium text-gray-900 dark:text-white">{label}</label > <input type="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} bind:value={config[key]} {min} {max} {step} bind:value={conversation.config[key]} /> </div> <input id="temperature-range" type="range" min={settings.min} max={settings.max} step={settings.step} bind:value={config[key]} {min} {max} {step} bind:value={conversation.config[key]} 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>17 unmodified lines min={settings.min} max={settings.max} step={settings.step} value={config[key] ?? settings.default} on:input={(e) => (config[key] = e.currentTarget.value)} value={conversation.config[key] ?? settings.default} on:input={(e) => (conversation.config[key] = Number(e.currentTarget.value))} /> </div> <input2 unmodified lines min={settings.min} max={settings.max} step={settings.step} value={config[key] ?? settings.default} on:input={(e) => (config[key] = e.currentTarget.value)} value={conversation.config[key] ?? settings.default} on:input={(e) => (conversation.config[key] = Number(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>3 unmodified lines
<div class="mt-2"> <label class="flex cursor-pointer items-center justify-between"> <input type="checkbox" bind:checked={streaming} class="peer sr-only" /> <input type="checkbox" bind:checked={conversation.streaming} class="peer sr-only" /> <span class="text-sm font-medium text-gray-900 dark:text-gray-300">Streaming</span> <div class="peer relative h-5 w-9 rounded-full bg-gray-200 after:absolute after:start-[2px] after:top-[2px] after:h-4 after:w-4 after:rounded-full after:border after:border-gray-300 after:bg-white after:transition-all after:content-[''] peer-checked:bg-black peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:peer-checked:bg-blue-600"src/lib/components/InferencePlayground/InferencePlayground.svelte+1-4
src/lib/components/InferencePlayground/InferencePlaygroundConversation.svelte+3-3
src/lib/components/InferencePlayground/InferencePlaygroundGenerationConfig.svelte+21-18