diff --git a/package.json b/package.json index d2e7759..6eb5d1e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "gerbil", "productName": "Gerbil", - "version": "1.11.0", + "version": "1.11.1", "description": "Run Large Language Models locally", "main": "out/main/index.js", "homepage": "./", diff --git a/src/components/screens/Launch/AdvancedTab.tsx b/src/components/screens/Launch/AdvancedTab.tsx index 87f708e..949346e 100644 --- a/src/components/screens/Launch/AdvancedTab.tsx +++ b/src/components/screens/Launch/AdvancedTab.tsx @@ -23,6 +23,7 @@ export const AdvancedTab = () => { lowvram, quantmatmul, usemmap, + debugmode, backend, moecpu, moeexperts, @@ -34,6 +35,7 @@ export const AdvancedTab = () => { handleLowvramChange, handleQuantmatmulChange, handleUsemmapChange, + handleDebugmodeChange, handleMoecpuChange, handleMoeexpertsChange, } = useLaunchConfig(); @@ -152,6 +154,13 @@ export const AdvancedTab = () => { } disabled={!isGpuBackend} /> + + diff --git a/src/components/screens/Launch/CommandLineArgumentsModal.tsx b/src/components/screens/Launch/CommandLineArgumentsModal.tsx index 8ebbe90..cb3f0fd 100644 --- a/src/components/screens/Launch/CommandLineArgumentsModal.tsx +++ b/src/components/screens/Launch/CommandLineArgumentsModal.tsx @@ -65,6 +65,7 @@ const UI_COVERED_ARGS = new Set([ '--sdclipgpu', '--sdflashattention', '--tensor_split', + '--debugmode', ] as const) as ReadonlySet; const IGNORED_ARGS = new Set([ @@ -195,13 +196,6 @@ const COMMAND_LINE_ARGUMENTS = [ type: 'boolean', category: 'Advanced', }, - { - flag: '--debugmode', - description: 'Shows additional debug info in the terminal.', - type: 'int', - default: 0, - category: 'Advanced', - }, { flag: '--onready', description: diff --git a/src/components/screens/Launch/index.tsx b/src/components/screens/Launch/index.tsx index b22af46..328d484 100644 --- a/src/components/screens/Launch/index.tsx +++ b/src/components/screens/Launch/index.tsx @@ -45,6 +45,7 @@ export const LaunchScreen = ({ onLaunch }: LaunchScreenProps) => { lowvram, quantmatmul, usemmap, + debugmode, backend, gpuDeviceSelection, gpuPlatform, @@ -170,6 +171,7 @@ export const LaunchScreen = ({ onLaunch }: LaunchScreenProps) => { noavx2, failsafe, usemmap, + debugmode, moecpu, moeexperts, usecuda: backend === 'cuda' || backend === 'rocm', @@ -297,6 +299,7 @@ export const LaunchScreen = ({ onLaunch }: LaunchScreenProps) => { tensorSplit, quantmatmul, usemmap, + debugmode, additionalArguments, sdt5xxl, sdclipl, @@ -333,6 +336,7 @@ export const LaunchScreen = ({ onLaunch }: LaunchScreenProps) => { tensorSplit, quantmatmul, usemmap, + debugmode, additionalArguments, sdt5xxl, sdclipl, diff --git a/src/hooks/useLaunchConfig.ts b/src/hooks/useLaunchConfig.ts index b83aa35..1f3b749 100644 --- a/src/hooks/useLaunchConfig.ts +++ b/src/hooks/useLaunchConfig.ts @@ -27,6 +27,7 @@ export const useLaunchConfig = () => { lowvram: state.lowvram, quantmatmul: state.quantmatmul, usemmap: state.usemmap, + debugmode: state.debugmode, backend: state.backend, gpuDeviceSelection: state.gpuDeviceSelection, tensorSplit: state.tensorSplit, @@ -63,6 +64,7 @@ export const useLaunchConfig = () => { handleLowvramChange: state.setLowvram, handleQuantmatmulChange: state.setQuantmatmul, handleUsemmapChange: state.setUsemmap, + handleDebugmodeChange: state.setDebugmode, handleBackendChange: state.setBackend, handleGpuDeviceSelectionChange: state.setGpuDeviceSelection, handleTensorSplitChange: state.setTensorSplit, diff --git a/src/hooks/useLaunchLogic.ts b/src/hooks/useLaunchLogic.ts index b106728..a26a06d 100644 --- a/src/hooks/useLaunchLogic.ts +++ b/src/hooks/useLaunchLogic.ts @@ -29,6 +29,7 @@ interface LaunchArgs { tensorSplit: string; quantmatmul: boolean; usemmap: boolean; + debugmode: boolean; additionalArguments: string; sdt5xxl: string; sdclipl: string; @@ -128,6 +129,7 @@ const buildConfigArgs = (isImageMode: boolean, launchArgs: LaunchArgs) => { [launchArgs.noavx2, '--noavx2'], [launchArgs.failsafe, '--failsafe'], [launchArgs.usemmap, '--usemmap'], + [launchArgs.debugmode, '--debugmode', '1'], ]; flagMappings.forEach(([condition, flag, value]) => { diff --git a/src/main/modules/koboldcpp/launcher/index.ts b/src/main/modules/koboldcpp/launcher/index.ts index 0304910..c5d5864 100644 --- a/src/main/modules/koboldcpp/launcher/index.ts +++ b/src/main/modules/koboldcpp/launcher/index.ts @@ -101,7 +101,7 @@ export async function launchKoboldCpp( const binaryDir = currentVersion.path.split(/[/\\]/).slice(0, -1).join('/'); - const { isImageMode, isTextMode } = parseKoboldConfig(args); + const { isImageMode, isTextMode, debugmode } = parseKoboldConfig(args); if (frontendPreference === 'koboldcpp') { if (isImageMode) { @@ -148,7 +148,7 @@ export async function launchKoboldCpp( child.stdout?.on('data', (data) => { const output = data.toString(); - const filtered = filterSpam(output); + const filtered = debugmode ? output : filterSpam(output); if (filtered.trim()) { sendKoboldOutput(filtered, true); } @@ -161,7 +161,7 @@ export async function launchKoboldCpp( child.stderr?.on('data', (data) => { const output = data.toString(); - const filtered = filterSpam(output); + const filtered = debugmode ? output : filterSpam(output); if (filtered.trim()) { sendKoboldOutput(filtered, true); } diff --git a/src/stores/launchConfig.ts b/src/stores/launchConfig.ts index 5f29c74..65291d4 100644 --- a/src/stores/launchConfig.ts +++ b/src/stores/launchConfig.ts @@ -23,6 +23,7 @@ interface LaunchConfigState { lowvram: boolean; quantmatmul: boolean; usemmap: boolean; + debugmode: boolean; backend: string; gpuDeviceSelection: string; tensorSplit: string; @@ -61,6 +62,7 @@ interface LaunchConfigState { setLowvram: (lowvram: boolean) => void; setQuantmatmul: (quantmatmul: boolean) => void; setUsemmap: (usemmap: boolean) => void; + setDebugmode: (debugmode: boolean) => void; setBackend: (backend: string) => void; setGpuDeviceSelection: (selection: string) => void; setTensorSplit: (split: string) => void; @@ -115,6 +117,7 @@ export const useLaunchConfigStore = create((set, get) => ({ lowvram: false, quantmatmul: true, usemmap: true, + debugmode: false, backend: '', gpuDeviceSelection: '0', tensorSplit: '', @@ -158,6 +161,7 @@ export const useLaunchConfigStore = create((set, get) => ({ setLowvram: (lowvram) => set({ lowvram }), setQuantmatmul: (quantmatmul) => set({ quantmatmul }), setUsemmap: (usemmap) => set({ usemmap }), + setDebugmode: (debugmode) => set({ debugmode }), setBackend: (backend) => set({ backend, @@ -301,6 +305,12 @@ export const useLaunchConfigStore = create((set, get) => ({ updates.usemmap = true; } + if (typeof configData.debugmode === 'boolean') { + updates.debugmode = configData.debugmode; + } else { + updates.debugmode = false; + } + if (configData.usecuda === true) { const gpuInfo = await window.electronAPI.kobold.detectGPU(); updates.backend = gpuInfo.hasNVIDIA ? 'cuda' : 'rocm'; diff --git a/src/types/electron.d.ts b/src/types/electron.d.ts index 30866e3..7e7d1d9 100644 --- a/src/types/electron.d.ts +++ b/src/types/electron.d.ts @@ -98,6 +98,7 @@ export interface KoboldConfig { lowvram?: boolean; quantmatmul?: boolean; usemmap?: boolean; + debugmode?: boolean; usecuda?: boolean; usevulkan?: boolean; useclblast?: boolean | [number, number]; diff --git a/src/utils/node/kobold.ts b/src/utils/node/kobold.ts index c39cfe4..757b5eb 100644 --- a/src/utils/node/kobold.ts +++ b/src/utils/node/kobold.ts @@ -3,11 +3,15 @@ export function parseKoboldConfig(args: string[]) { let port = 5001; let hasSdModel = false; let hasTextModel = false; + let debugmode = false; - for (let i = 0; i < args.length - 1; i++) { - if (args[i] === '--hostname' || args[i] === '--host') { + for (let i = 0; i < args.length; i++) { + if ( + (args[i] === '--hostname' || args[i] === '--host') && + i + 1 < args.length + ) { host = args[i + 1]; - } else if (args[i] === '--port') { + } else if (args[i] === '--port' && i + 1 < args.length) { const parsedPort = parseInt(args[i + 1], 10); if (!isNaN(parsedPort)) { port = parsedPort; @@ -16,11 +20,13 @@ export function parseKoboldConfig(args: string[]) { hasSdModel = true; } else if (args[i] === '--model') { hasTextModel = true; + } else if (args[i] === '--debugmode') { + debugmode = true; } } const isImageMode = hasSdModel; const isTextMode = hasTextModel; - return { host, port, isImageMode, isTextMode }; + return { host, port, isImageMode, isTextMode, debugmode }; }