From d19c9bac3cac598ed2fe35c834e576e01a0be96f Mon Sep 17 00:00:00 2001 From: lone-cloud Date: Sun, 12 Oct 2025 00:45:09 -0700 Subject: [PATCH] update stable diffusion UI to latest, new advanced flags for kcpp 1.100, 3 new optional toggles for image generation --- assets/kcpp_sdui.embd | 70 +++++++++---------- package.json | 2 +- src/components/App/index.tsx | 2 +- .../Launch/CommandLineArgumentsModal.tsx | 28 +++++++- .../screens/Launch/ImageGenerationTab.tsx | 23 +++++- src/components/screens/Launch/index.tsx | 10 +++ src/hooks/useLaunchConfig.ts | 4 ++ src/hooks/useLaunchLogic.ts | 10 +++ src/main/modules/koboldcpp/launcher.ts | 4 +- src/stores/launchConfig.ts | 20 ++++++ src/types/electron.d.ts | 2 + 11 files changed, 134 insertions(+), 41 deletions(-) diff --git a/assets/kcpp_sdui.embd b/assets/kcpp_sdui.embd index 8799aa4..65858bf 100644 --- a/assets/kcpp_sdui.embd +++ b/assets/kcpp_sdui.embd @@ -5,31 +5,31 @@ Stable UI for KoboldCpp - - diff --git a/package.json b/package.json index 02ce090..68fa902 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "gerbil", "productName": "Gerbil", - "version": "1.6.9", + "version": "1.7.0", "description": "Run Large Language Models locally", "main": "out/main/index.js", "homepage": "./", diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx index 07be638..157229d 100644 --- a/src/components/App/index.tsx +++ b/src/components/App/index.tsx @@ -119,7 +119,7 @@ export const App = () => { if (currentVersion) { setTimeout(() => { checkForUpdates(); - }, 1000); + }, 5000); } }; diff --git a/src/components/screens/Launch/CommandLineArgumentsModal.tsx b/src/components/screens/Launch/CommandLineArgumentsModal.tsx index 7a5d481..0adf30e 100644 --- a/src/components/screens/Launch/CommandLineArgumentsModal.tsx +++ b/src/components/screens/Launch/CommandLineArgumentsModal.tsx @@ -55,11 +55,14 @@ const UI_COVERED_ARGS = new Set([ '--sdt5xxl', '--sdclipl', '--sdclipg', + '--sdclip1', + '--sdclip2', '--sdphotomaker', '--sdvae', '--sdlora', - '--sdflashattention', '--sdconvdirect', + '--sdvaecpu', + '--sdclipgpu', '--tensor_split', ] as const) as ReadonlySet; @@ -386,6 +389,14 @@ const COMMAND_LINE_ARGUMENTS = [ default: 0, category: 'Performance', }, + { + flag: '--lowvram', + aliases: ['-nkvo', '--no-kv-offload'], + description: + 'If supported by the backend, do not offload KV to GPU (lowvram mode). Not recommended, will be slow.', + type: 'boolean', + category: 'Performance', + }, { flag: '--defaultgenamt', description: @@ -639,6 +650,21 @@ const COMMAND_LINE_ARGUMENTS = [ default: 768, category: 'Image Generation', }, + { + flag: '--sdoffloadcpu', + description: + 'Offload image weights in RAM to save VRAM, swap into VRAM when needed.', + type: 'boolean', + category: 'Image Generation', + }, + { + flag: '--sdgendefaults', + description: + 'Sets default parameters for image generation, as a JSON string.', + metavar: '{"parameter":"value",...}', + default: '', + category: 'Image Generation', + }, { flag: '--whispermodel', description: diff --git a/src/components/screens/Launch/ImageGenerationTab.tsx b/src/components/screens/Launch/ImageGenerationTab.tsx index dc8f5b1..43426c3 100644 --- a/src/components/screens/Launch/ImageGenerationTab.tsx +++ b/src/components/screens/Launch/ImageGenerationTab.tsx @@ -1,7 +1,8 @@ -import { Stack } from '@mantine/core'; +import { Stack, Group } from '@mantine/core'; import { useState } from 'react'; import { ModelFileField } from '@/components/screens/Launch/ModelFileField'; import { SelectWithTooltip } from '@/components/SelectWithTooltip'; +import { CheckboxWithTooltip } from '@/components/CheckboxWithTooltip'; import { IMAGE_MODEL_PRESETS } from '@/constants/imageModelPresets'; import { useLaunchConfig } from '@/hooks/useLaunchConfig'; @@ -15,6 +16,8 @@ export const ImageGenerationTab = () => { sdvae, sdlora, sdconvdirect, + sdvaecpu, + sdclipgpu, handleSdmodelChange, handleSdt5xxlChange, handleSdcliplChange, @@ -23,6 +26,8 @@ export const ImageGenerationTab = () => { handleSdvaeChange, handleSdloraChange, handleSdconvdirectChange, + handleSdvaecpuChange, + handleSdclipgpuChange, handleApplyPreset, handleSelectSdmodelFile, handleSelectSdt5xxlFile, @@ -143,6 +148,22 @@ export const ImageGenerationTab = () => { { value: 'full', label: 'Full' }, ]} /> + + + + + + ); }; diff --git a/src/components/screens/Launch/index.tsx b/src/components/screens/Launch/index.tsx index 19255b4..b22af46 100644 --- a/src/components/screens/Launch/index.tsx +++ b/src/components/screens/Launch/index.tsx @@ -57,6 +57,8 @@ export const LaunchScreen = ({ onLaunch }: LaunchScreenProps) => { sdvae, sdlora, sdconvdirect, + sdvaecpu, + sdclipgpu, moecpu, moeexperts, parseAndApplyConfigFile, @@ -181,6 +183,10 @@ export const LaunchScreen = ({ onLaunch }: LaunchScreenProps) => { sdclipg, sdphotomaker, sdvae, + sdlora, + sdconvdirect, + sdvaecpu, + sdclipgpu, }); const handleCreateNewConfig = async (configName: string) => { @@ -299,6 +305,8 @@ export const LaunchScreen = ({ onLaunch }: LaunchScreenProps) => { sdvae, sdlora, sdconvdirect, + sdvaecpu, + sdclipgpu, moecpu, moeexperts, }); @@ -333,6 +341,8 @@ export const LaunchScreen = ({ onLaunch }: LaunchScreenProps) => { sdvae, sdlora, sdconvdirect, + sdvaecpu, + sdclipgpu, moecpu, moeexperts, ]); diff --git a/src/hooks/useLaunchConfig.ts b/src/hooks/useLaunchConfig.ts index 4e4fb62..b83aa35 100644 --- a/src/hooks/useLaunchConfig.ts +++ b/src/hooks/useLaunchConfig.ts @@ -39,6 +39,8 @@ export const useLaunchConfig = () => { sdvae: state.sdvae, sdlora: state.sdlora, sdconvdirect: state.sdconvdirect, + sdvaecpu: state.sdvaecpu, + sdclipgpu: state.sdclipgpu, moecpu: state.moecpu, moeexperts: state.moeexperts, @@ -73,6 +75,8 @@ export const useLaunchConfig = () => { handleSdvaeChange: state.setSdvae, handleSdloraChange: state.setSdlora, handleSdconvdirectChange: state.setSdconvdirect, + handleSdvaecpuChange: state.setSdvaecpu, + handleSdclipgpuChange: state.setSdclipgpu, handleMoecpuChange: state.setMoecpu, handleMoeexpertsChange: state.setMoeexperts, diff --git a/src/hooks/useLaunchLogic.ts b/src/hooks/useLaunchLogic.ts index 0ca8bc0..61daadc 100644 --- a/src/hooks/useLaunchLogic.ts +++ b/src/hooks/useLaunchLogic.ts @@ -37,6 +37,8 @@ interface LaunchArgs { sdvae: string; sdlora: string; sdconvdirect: SdConvDirectMode; + sdvaecpu: boolean; + sdclipgpu: boolean; moecpu: number; moeexperts: number; } @@ -74,6 +76,14 @@ const buildModelArgs = ( args.push('--sdflashattention'); } + if (launchArgs.sdvaecpu) { + args.push('--sdvaecpu'); + } + + if (launchArgs.sdclipgpu) { + args.push('--sdclipgpu'); + } + if (launchArgs.sdconvdirect !== 'off') { args.push('--sdconvdirect', launchArgs.sdconvdirect); } diff --git a/src/main/modules/koboldcpp/launcher.ts b/src/main/modules/koboldcpp/launcher.ts index fef5426..d80bbae 100644 --- a/src/main/modules/koboldcpp/launcher.ts +++ b/src/main/modules/koboldcpp/launcher.ts @@ -25,7 +25,7 @@ let koboldProcess: ChildProcess | null = null; const patchKliteEmbd = (unpackedDir: string) => tryExecute(async () => { const possiblePaths = [ - join(unpackedDir, '_internal', 'klite.embd'), + join(unpackedDir, '_internal', 'embd_res', 'klite.embd'), join(unpackedDir, 'klite.embd'), ]; @@ -72,7 +72,7 @@ const patchKliteEmbd = (unpackedDir: string) => const patchKcppSduiEmbd = (unpackedDir: string) => tryExecute(async () => { const possiblePaths = [ - join(unpackedDir, '_internal', 'kcpp_sdui.embd'), + join(unpackedDir, '_internal', 'embd_res', 'kcpp_sdui.embd'), join(unpackedDir, 'kcpp_sdui.embd'), ]; diff --git a/src/stores/launchConfig.ts b/src/stores/launchConfig.ts index ca0afca..255994f 100644 --- a/src/stores/launchConfig.ts +++ b/src/stores/launchConfig.ts @@ -35,6 +35,8 @@ interface LaunchConfigState { sdvae: string; sdlora: string; sdconvdirect: SdConvDirectMode; + sdvaecpu: boolean; + sdclipgpu: boolean; moecpu: number; moeexperts: number; isImageGenerationMode: boolean; @@ -71,6 +73,8 @@ interface LaunchConfigState { setSdvae: (vae: string) => void; setSdlora: (loraModel: string) => void; setSdconvdirect: (mode: SdConvDirectMode) => void; + setSdvaecpu: (enabled: boolean) => void; + setSdclipgpu: (enabled: boolean) => void; setMoecpu: (moecpu: number) => void; setMoeexperts: (moeexperts: number) => void; @@ -123,6 +127,8 @@ export const useLaunchConfigStore = create((set, get) => ({ sdvae: '', sdlora: '', sdconvdirect: 'off' as const, + sdvaecpu: false, + sdclipgpu: false, moecpu: 0, moeexperts: -1, @@ -173,6 +179,8 @@ export const useLaunchConfigStore = create((set, get) => ({ setSdvae: (vae) => set({ sdvae: vae }), setSdlora: (loraModel) => set({ sdlora: loraModel }), setSdconvdirect: (mode) => set({ sdconvdirect: mode }), + setSdvaecpu: (enabled) => set({ sdvaecpu: enabled }), + setSdclipgpu: (enabled) => set({ sdclipgpu: enabled }), setMoecpu: (moeCpu) => set({ moecpu: moeCpu }), setMoeexperts: (moeExperts) => set({ moeexperts: moeExperts }), @@ -363,6 +371,18 @@ export const useLaunchConfigStore = create((set, get) => ({ updates.sdconvdirect = configData.sdconvdirect as SdConvDirectMode; } + if (typeof configData.sdvaecpu === 'boolean') { + updates.sdvaecpu = configData.sdvaecpu; + } else { + updates.sdvaecpu = false; + } + + if (typeof configData.sdclipgpu === 'boolean') { + updates.sdclipgpu = configData.sdclipgpu; + } else { + updates.sdclipgpu = false; + } + if (typeof configData.moecpu === 'number') { updates.moecpu = configData.moecpu; } else { diff --git a/src/types/electron.d.ts b/src/types/electron.d.ts index ede55f1..ec6b2ea 100644 --- a/src/types/electron.d.ts +++ b/src/types/electron.d.ts @@ -97,6 +97,8 @@ export interface KoboldConfig { sdvae?: string; sdlora?: string; sdconvdirect?: string; + sdvaecpu?: boolean; + sdclipgpu?: boolean; additionalArguments?: string; moecpu?: number; moeexperts?: number;