Spaces:
Runtime error
Runtime error
Download src/lib/components/InferencePlayground/generationConfigSettings.ts from FallnAI/LLM-Inference: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/spaces/FallnAI/LLM-Inference/resolve/2f8477eb7ebef3fd3a2489d8a4b5cf5f76be2f3d/src/lib/components/InferencePlayground/generationConfigSettings.ts
- Command line
-
hf download hf://spaces/FallnAI/LLM-Inference@2f8477eb7ebef3fd3a2489d8a4b5cf5f76be2f3d/src/lib/components/InferencePlayground/generationConfigSettings.ts
-
curl -L -o generationConfigSettings.ts https://huggingface.co/spaces/FallnAI/LLM-Inference/resolve/2f8477eb7ebef3fd3a2489d8a4b5cf5f76be2f3d/src/lib/components/InferencePlayground/generationConfigSettings.ts
1.01 kB
| import type { ChatCompletionInput } from "@huggingface/tasks"; | |
| export const GENERATION_CONFIG_KEYS = ["temperature", "max_tokens", "top_p"] as const; | |
| export type GenerationConfigKey = (typeof GENERATION_CONFIG_KEYS)[number]; | |
| export type GenerationConfig = Pick<ChatCompletionInput, GenerationConfigKey>; | |
| interface GenerationKeySettings { | |
| default: number; | |
| step: number; | |
| min: number; | |
| max: number; | |
| label: string; | |
| } | |
| export const GENERATION_CONFIG_SETTINGS: Record<GenerationConfigKey, GenerationKeySettings> = { | |
| temperature: { | |
| default: 0.5, | |
| step: 0.1, | |
| min: 0, | |
| max: 2, | |
| label: "Temperature", | |
| }, | |
| max_tokens: { | |
| default: 2048, | |
| step: 256, | |
| min: 0, | |
| max: 8192, // changed dynamically based on model | |
| label: "Max Tokens", | |
| }, | |
| top_p: { | |
| default: 0.7, | |
| step: 0.1, | |
| min: 0, | |
| max: 1, | |
| label: "Top-P", | |
| }, | |
| }; | |
| export const defaultGenerationConfig = GENERATION_CONFIG_KEYS.reduce((acc, key) => { | |
| acc[key] = GENERATION_CONFIG_SETTINGS[key].default; | |
| return acc; | |
| }, {} as GenerationConfig); | |