diff --git a/package.json b/package.json index e750b2c..bf452f0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "gerbil", "productName": "Gerbil", - "version": "1.7.0", + "version": "1.7.1", "description": "Run Large Language Models locally", "main": "out/main/index.js", "homepage": "./", diff --git a/src/hooks/useWarnings.ts b/src/hooks/useWarnings.ts index c1eadd1..af977f1 100644 --- a/src/hooks/useWarnings.ts +++ b/src/hooks/useWarnings.ts @@ -1,6 +1,6 @@ import { useEffect, useState, useCallback, useMemo } from 'react'; -import type { BackendOption, BackendSupport } from '@/types'; import { CPUCapabilities, GPUDevice } from '@/types/hardware'; +import type { BackendOption, BackendSupport } from '@/types'; export interface Warning { type: 'warning' | 'info'; @@ -61,7 +61,7 @@ const checkGpuWarnings = async ( backendSupport: BackendSupport, gpuCapabilities: GpuCapabilities, gpuInfo: GpuInfo -): Promise => { +) => { const warnings: Warning[] = []; if ( diff --git a/src/main/modules/hardware.ts b/src/main/modules/hardware.ts index ae117c2..05c41db 100644 --- a/src/main/modules/hardware.ts +++ b/src/main/modules/hardware.ts @@ -126,7 +126,11 @@ async function detectVulkan() { async function detectCUDA() { try { - const { stdout } = await execa('nvidia-smi', [], COMMON_EXEC_OPTIONS); + const { stdout } = await execa( + 'nvidia-smi', + ['--query-gpu=name,driver_version,cuda_version', '--format=csv,noheader'], + COMMON_EXEC_OPTIONS + ); if (stdout.trim()) { const errorPatterns = [ @@ -145,33 +149,21 @@ async function detectCUDA() { return { devices: [] } as const; } + const lines = stdout.split('\n').filter((line) => line.trim()); const devices: string[] = []; - let cudaVersion: string | undefined; let driverVersion: string | undefined; + let cudaVersion: string | undefined; - const cudaMatch = stdout.match(/CUDA Version:\s*(\d+\.\d+)/); - if (cudaMatch) { - cudaVersion = cudaMatch[1]; - } - - const driverMatch = stdout.match( - /Driver Version:\s*(\d+\.\d+(?:\.\d+)?)/ - ); - - if (driverMatch) { - driverVersion = driverMatch[1]; - } - - const gpuNameMatch = stdout.match(/\|\s+\d+\s+([^|]+)\s+On\s+\|/g); - - if (gpuNameMatch) { - for (const match of gpuNameMatch) { - const name = match - .replace(/\|\s+\d+\s+([^|]+)\s+On\s+\|/, '$1') - .trim(); - if (name) { - devices.push(formatDeviceName(name)); - } + for (const line of lines) { + const [name, driver, cuda] = line.split(',').map((s) => s.trim()); + if (name) { + devices.push(formatDeviceName(name)); + } + if (driver && !driverVersion) { + driverVersion = driver; + } + if (cuda && !cudaVersion) { + cudaVersion = cuda; } } diff --git a/yarn.lock b/yarn.lock index 7a5f380..a21a25c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1376,12 +1376,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*": - version: 24.9.0 - resolution: "@types/node@npm:24.9.0" +"@types/node@npm:*, @types/node@npm:^24.9.1": + version: 24.9.1 + resolution: "@types/node@npm:24.9.1" dependencies: undici-types: "npm:~7.16.0" - checksum: 10c0/c0129572f2c1528d2d1b7f4ebdbc3c4b40273964d40786c8be3596e7482394ed4882676b2a44362d4b1da5bac0274fdf2cae11dce3d76319cadac541fd76e531 + checksum: 10c0/c52f8168080ef9a7c3dc23d8ac6061fab5371aad89231a0f6f4c075869bc3de7e89b075b1f3e3171d9e5143d0dda1807c3dab8e32eac6d68f02e7480e7e78576 languageName: node linkType: hard @@ -1394,15 +1394,6 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^24.9.1": - version: 24.9.1 - resolution: "@types/node@npm:24.9.1" - dependencies: - undici-types: "npm:~7.16.0" - checksum: 10c0/c52f8168080ef9a7c3dc23d8ac6061fab5371aad89231a0f6f4c075869bc3de7e89b075b1f3e3171d9e5143d0dda1807c3dab8e32eac6d68f02e7480e7e78576 - languageName: node - linkType: hard - "@types/plist@npm:^3.0.1": version: 3.0.5 resolution: "@types/plist@npm:3.0.5"