promoting debugmode to a first class citizen with a new checkbox on the advanced tab and stop filtering llama.cpp spam when it's turned on

This commit is contained in:
Egor 2025-11-25 10:17:01 -08:00
parent 170def08ca
commit b332d71bd9
10 changed files with 43 additions and 15 deletions

View file

@ -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": "./",

View file

@ -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}
/>
<CheckboxWithTooltip
checked={debugmode}
onChange={handleDebugmodeChange}
label="Debug Mode"
tooltip="Shows additional debug info in the terminal."
/>
</SimpleGrid>
</div>

View file

@ -65,6 +65,7 @@ const UI_COVERED_ARGS = new Set([
'--sdclipgpu',
'--sdflashattention',
'--tensor_split',
'--debugmode',
] as const) as ReadonlySet<string>;
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:

View file

@ -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,

View file

@ -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,

View file

@ -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]) => {

View file

@ -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);
}

View file

@ -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<LaunchConfigState>((set, get) => ({
lowvram: false,
quantmatmul: true,
usemmap: true,
debugmode: false,
backend: '',
gpuDeviceSelection: '0',
tensorSplit: '',
@ -158,6 +161,7 @@ export const useLaunchConfigStore = create<LaunchConfigState>((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<LaunchConfigState>((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';

View file

@ -98,6 +98,7 @@ export interface KoboldConfig {
lowvram?: boolean;
quantmatmul?: boolean;
usemmap?: boolean;
debugmode?: boolean;
usecuda?: boolean;
usevulkan?: boolean;
useclblast?: boolean | [number, number];

View file

@ -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 };
}