mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 09:33:10 -07:00
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:
parent
170def08ca
commit
b332d71bd9
10 changed files with 43 additions and 15 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "gerbil",
|
"name": "gerbil",
|
||||||
"productName": "Gerbil",
|
"productName": "Gerbil",
|
||||||
"version": "1.11.0",
|
"version": "1.11.1",
|
||||||
"description": "Run Large Language Models locally",
|
"description": "Run Large Language Models locally",
|
||||||
"main": "out/main/index.js",
|
"main": "out/main/index.js",
|
||||||
"homepage": "./",
|
"homepage": "./",
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ export const AdvancedTab = () => {
|
||||||
lowvram,
|
lowvram,
|
||||||
quantmatmul,
|
quantmatmul,
|
||||||
usemmap,
|
usemmap,
|
||||||
|
debugmode,
|
||||||
backend,
|
backend,
|
||||||
moecpu,
|
moecpu,
|
||||||
moeexperts,
|
moeexperts,
|
||||||
|
|
@ -34,6 +35,7 @@ export const AdvancedTab = () => {
|
||||||
handleLowvramChange,
|
handleLowvramChange,
|
||||||
handleQuantmatmulChange,
|
handleQuantmatmulChange,
|
||||||
handleUsemmapChange,
|
handleUsemmapChange,
|
||||||
|
handleDebugmodeChange,
|
||||||
handleMoecpuChange,
|
handleMoecpuChange,
|
||||||
handleMoeexpertsChange,
|
handleMoeexpertsChange,
|
||||||
} = useLaunchConfig();
|
} = useLaunchConfig();
|
||||||
|
|
@ -152,6 +154,13 @@ export const AdvancedTab = () => {
|
||||||
}
|
}
|
||||||
disabled={!isGpuBackend}
|
disabled={!isGpuBackend}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<CheckboxWithTooltip
|
||||||
|
checked={debugmode}
|
||||||
|
onChange={handleDebugmodeChange}
|
||||||
|
label="Debug Mode"
|
||||||
|
tooltip="Shows additional debug info in the terminal."
|
||||||
|
/>
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ const UI_COVERED_ARGS = new Set([
|
||||||
'--sdclipgpu',
|
'--sdclipgpu',
|
||||||
'--sdflashattention',
|
'--sdflashattention',
|
||||||
'--tensor_split',
|
'--tensor_split',
|
||||||
|
'--debugmode',
|
||||||
] as const) as ReadonlySet<string>;
|
] as const) as ReadonlySet<string>;
|
||||||
|
|
||||||
const IGNORED_ARGS = new Set([
|
const IGNORED_ARGS = new Set([
|
||||||
|
|
@ -195,13 +196,6 @@ const COMMAND_LINE_ARGUMENTS = [
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
category: 'Advanced',
|
category: 'Advanced',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
flag: '--debugmode',
|
|
||||||
description: 'Shows additional debug info in the terminal.',
|
|
||||||
type: 'int',
|
|
||||||
default: 0,
|
|
||||||
category: 'Advanced',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
flag: '--onready',
|
flag: '--onready',
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ export const LaunchScreen = ({ onLaunch }: LaunchScreenProps) => {
|
||||||
lowvram,
|
lowvram,
|
||||||
quantmatmul,
|
quantmatmul,
|
||||||
usemmap,
|
usemmap,
|
||||||
|
debugmode,
|
||||||
backend,
|
backend,
|
||||||
gpuDeviceSelection,
|
gpuDeviceSelection,
|
||||||
gpuPlatform,
|
gpuPlatform,
|
||||||
|
|
@ -170,6 +171,7 @@ export const LaunchScreen = ({ onLaunch }: LaunchScreenProps) => {
|
||||||
noavx2,
|
noavx2,
|
||||||
failsafe,
|
failsafe,
|
||||||
usemmap,
|
usemmap,
|
||||||
|
debugmode,
|
||||||
moecpu,
|
moecpu,
|
||||||
moeexperts,
|
moeexperts,
|
||||||
usecuda: backend === 'cuda' || backend === 'rocm',
|
usecuda: backend === 'cuda' || backend === 'rocm',
|
||||||
|
|
@ -297,6 +299,7 @@ export const LaunchScreen = ({ onLaunch }: LaunchScreenProps) => {
|
||||||
tensorSplit,
|
tensorSplit,
|
||||||
quantmatmul,
|
quantmatmul,
|
||||||
usemmap,
|
usemmap,
|
||||||
|
debugmode,
|
||||||
additionalArguments,
|
additionalArguments,
|
||||||
sdt5xxl,
|
sdt5xxl,
|
||||||
sdclipl,
|
sdclipl,
|
||||||
|
|
@ -333,6 +336,7 @@ export const LaunchScreen = ({ onLaunch }: LaunchScreenProps) => {
|
||||||
tensorSplit,
|
tensorSplit,
|
||||||
quantmatmul,
|
quantmatmul,
|
||||||
usemmap,
|
usemmap,
|
||||||
|
debugmode,
|
||||||
additionalArguments,
|
additionalArguments,
|
||||||
sdt5xxl,
|
sdt5xxl,
|
||||||
sdclipl,
|
sdclipl,
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ export const useLaunchConfig = () => {
|
||||||
lowvram: state.lowvram,
|
lowvram: state.lowvram,
|
||||||
quantmatmul: state.quantmatmul,
|
quantmatmul: state.quantmatmul,
|
||||||
usemmap: state.usemmap,
|
usemmap: state.usemmap,
|
||||||
|
debugmode: state.debugmode,
|
||||||
backend: state.backend,
|
backend: state.backend,
|
||||||
gpuDeviceSelection: state.gpuDeviceSelection,
|
gpuDeviceSelection: state.gpuDeviceSelection,
|
||||||
tensorSplit: state.tensorSplit,
|
tensorSplit: state.tensorSplit,
|
||||||
|
|
@ -63,6 +64,7 @@ export const useLaunchConfig = () => {
|
||||||
handleLowvramChange: state.setLowvram,
|
handleLowvramChange: state.setLowvram,
|
||||||
handleQuantmatmulChange: state.setQuantmatmul,
|
handleQuantmatmulChange: state.setQuantmatmul,
|
||||||
handleUsemmapChange: state.setUsemmap,
|
handleUsemmapChange: state.setUsemmap,
|
||||||
|
handleDebugmodeChange: state.setDebugmode,
|
||||||
handleBackendChange: state.setBackend,
|
handleBackendChange: state.setBackend,
|
||||||
handleGpuDeviceSelectionChange: state.setGpuDeviceSelection,
|
handleGpuDeviceSelectionChange: state.setGpuDeviceSelection,
|
||||||
handleTensorSplitChange: state.setTensorSplit,
|
handleTensorSplitChange: state.setTensorSplit,
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ interface LaunchArgs {
|
||||||
tensorSplit: string;
|
tensorSplit: string;
|
||||||
quantmatmul: boolean;
|
quantmatmul: boolean;
|
||||||
usemmap: boolean;
|
usemmap: boolean;
|
||||||
|
debugmode: boolean;
|
||||||
additionalArguments: string;
|
additionalArguments: string;
|
||||||
sdt5xxl: string;
|
sdt5xxl: string;
|
||||||
sdclipl: string;
|
sdclipl: string;
|
||||||
|
|
@ -128,6 +129,7 @@ const buildConfigArgs = (isImageMode: boolean, launchArgs: LaunchArgs) => {
|
||||||
[launchArgs.noavx2, '--noavx2'],
|
[launchArgs.noavx2, '--noavx2'],
|
||||||
[launchArgs.failsafe, '--failsafe'],
|
[launchArgs.failsafe, '--failsafe'],
|
||||||
[launchArgs.usemmap, '--usemmap'],
|
[launchArgs.usemmap, '--usemmap'],
|
||||||
|
[launchArgs.debugmode, '--debugmode', '1'],
|
||||||
];
|
];
|
||||||
|
|
||||||
flagMappings.forEach(([condition, flag, value]) => {
|
flagMappings.forEach(([condition, flag, value]) => {
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ export async function launchKoboldCpp(
|
||||||
|
|
||||||
const binaryDir = currentVersion.path.split(/[/\\]/).slice(0, -1).join('/');
|
const binaryDir = currentVersion.path.split(/[/\\]/).slice(0, -1).join('/');
|
||||||
|
|
||||||
const { isImageMode, isTextMode } = parseKoboldConfig(args);
|
const { isImageMode, isTextMode, debugmode } = parseKoboldConfig(args);
|
||||||
|
|
||||||
if (frontendPreference === 'koboldcpp') {
|
if (frontendPreference === 'koboldcpp') {
|
||||||
if (isImageMode) {
|
if (isImageMode) {
|
||||||
|
|
@ -148,7 +148,7 @@ export async function launchKoboldCpp(
|
||||||
|
|
||||||
child.stdout?.on('data', (data) => {
|
child.stdout?.on('data', (data) => {
|
||||||
const output = data.toString();
|
const output = data.toString();
|
||||||
const filtered = filterSpam(output);
|
const filtered = debugmode ? output : filterSpam(output);
|
||||||
if (filtered.trim()) {
|
if (filtered.trim()) {
|
||||||
sendKoboldOutput(filtered, true);
|
sendKoboldOutput(filtered, true);
|
||||||
}
|
}
|
||||||
|
|
@ -161,7 +161,7 @@ export async function launchKoboldCpp(
|
||||||
|
|
||||||
child.stderr?.on('data', (data) => {
|
child.stderr?.on('data', (data) => {
|
||||||
const output = data.toString();
|
const output = data.toString();
|
||||||
const filtered = filterSpam(output);
|
const filtered = debugmode ? output : filterSpam(output);
|
||||||
if (filtered.trim()) {
|
if (filtered.trim()) {
|
||||||
sendKoboldOutput(filtered, true);
|
sendKoboldOutput(filtered, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ interface LaunchConfigState {
|
||||||
lowvram: boolean;
|
lowvram: boolean;
|
||||||
quantmatmul: boolean;
|
quantmatmul: boolean;
|
||||||
usemmap: boolean;
|
usemmap: boolean;
|
||||||
|
debugmode: boolean;
|
||||||
backend: string;
|
backend: string;
|
||||||
gpuDeviceSelection: string;
|
gpuDeviceSelection: string;
|
||||||
tensorSplit: string;
|
tensorSplit: string;
|
||||||
|
|
@ -61,6 +62,7 @@ interface LaunchConfigState {
|
||||||
setLowvram: (lowvram: boolean) => void;
|
setLowvram: (lowvram: boolean) => void;
|
||||||
setQuantmatmul: (quantmatmul: boolean) => void;
|
setQuantmatmul: (quantmatmul: boolean) => void;
|
||||||
setUsemmap: (usemmap: boolean) => void;
|
setUsemmap: (usemmap: boolean) => void;
|
||||||
|
setDebugmode: (debugmode: boolean) => void;
|
||||||
setBackend: (backend: string) => void;
|
setBackend: (backend: string) => void;
|
||||||
setGpuDeviceSelection: (selection: string) => void;
|
setGpuDeviceSelection: (selection: string) => void;
|
||||||
setTensorSplit: (split: string) => void;
|
setTensorSplit: (split: string) => void;
|
||||||
|
|
@ -115,6 +117,7 @@ export const useLaunchConfigStore = create<LaunchConfigState>((set, get) => ({
|
||||||
lowvram: false,
|
lowvram: false,
|
||||||
quantmatmul: true,
|
quantmatmul: true,
|
||||||
usemmap: true,
|
usemmap: true,
|
||||||
|
debugmode: false,
|
||||||
backend: '',
|
backend: '',
|
||||||
gpuDeviceSelection: '0',
|
gpuDeviceSelection: '0',
|
||||||
tensorSplit: '',
|
tensorSplit: '',
|
||||||
|
|
@ -158,6 +161,7 @@ export const useLaunchConfigStore = create<LaunchConfigState>((set, get) => ({
|
||||||
setLowvram: (lowvram) => set({ lowvram }),
|
setLowvram: (lowvram) => set({ lowvram }),
|
||||||
setQuantmatmul: (quantmatmul) => set({ quantmatmul }),
|
setQuantmatmul: (quantmatmul) => set({ quantmatmul }),
|
||||||
setUsemmap: (usemmap) => set({ usemmap }),
|
setUsemmap: (usemmap) => set({ usemmap }),
|
||||||
|
setDebugmode: (debugmode) => set({ debugmode }),
|
||||||
setBackend: (backend) =>
|
setBackend: (backend) =>
|
||||||
set({
|
set({
|
||||||
backend,
|
backend,
|
||||||
|
|
@ -301,6 +305,12 @@ export const useLaunchConfigStore = create<LaunchConfigState>((set, get) => ({
|
||||||
updates.usemmap = true;
|
updates.usemmap = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof configData.debugmode === 'boolean') {
|
||||||
|
updates.debugmode = configData.debugmode;
|
||||||
|
} else {
|
||||||
|
updates.debugmode = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (configData.usecuda === true) {
|
if (configData.usecuda === true) {
|
||||||
const gpuInfo = await window.electronAPI.kobold.detectGPU();
|
const gpuInfo = await window.electronAPI.kobold.detectGPU();
|
||||||
updates.backend = gpuInfo.hasNVIDIA ? 'cuda' : 'rocm';
|
updates.backend = gpuInfo.hasNVIDIA ? 'cuda' : 'rocm';
|
||||||
|
|
|
||||||
1
src/types/electron.d.ts
vendored
1
src/types/electron.d.ts
vendored
|
|
@ -98,6 +98,7 @@ export interface KoboldConfig {
|
||||||
lowvram?: boolean;
|
lowvram?: boolean;
|
||||||
quantmatmul?: boolean;
|
quantmatmul?: boolean;
|
||||||
usemmap?: boolean;
|
usemmap?: boolean;
|
||||||
|
debugmode?: boolean;
|
||||||
usecuda?: boolean;
|
usecuda?: boolean;
|
||||||
usevulkan?: boolean;
|
usevulkan?: boolean;
|
||||||
useclblast?: boolean | [number, number];
|
useclblast?: boolean | [number, number];
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,15 @@ export function parseKoboldConfig(args: string[]) {
|
||||||
let port = 5001;
|
let port = 5001;
|
||||||
let hasSdModel = false;
|
let hasSdModel = false;
|
||||||
let hasTextModel = false;
|
let hasTextModel = false;
|
||||||
|
let debugmode = false;
|
||||||
|
|
||||||
for (let i = 0; i < args.length - 1; i++) {
|
for (let i = 0; i < args.length; i++) {
|
||||||
if (args[i] === '--hostname' || args[i] === '--host') {
|
if (
|
||||||
|
(args[i] === '--hostname' || args[i] === '--host') &&
|
||||||
|
i + 1 < args.length
|
||||||
|
) {
|
||||||
host = args[i + 1];
|
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);
|
const parsedPort = parseInt(args[i + 1], 10);
|
||||||
if (!isNaN(parsedPort)) {
|
if (!isNaN(parsedPort)) {
|
||||||
port = parsedPort;
|
port = parsedPort;
|
||||||
|
|
@ -16,11 +20,13 @@ export function parseKoboldConfig(args: string[]) {
|
||||||
hasSdModel = true;
|
hasSdModel = true;
|
||||||
} else if (args[i] === '--model') {
|
} else if (args[i] === '--model') {
|
||||||
hasTextModel = true;
|
hasTextModel = true;
|
||||||
|
} else if (args[i] === '--debugmode') {
|
||||||
|
debugmode = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const isImageMode = hasSdModel;
|
const isImageMode = hasSdModel;
|
||||||
const isTextMode = hasTextModel;
|
const isTextMode = hasTextModel;
|
||||||
|
|
||||||
return { host, port, isImageMode, isTextMode };
|
return { host, port, isImageMode, isTextMode, debugmode };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue