llm-checker 3.5.11 → 3.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/enhanced_cli.js +24 -2
- package/package.json +1 -1
- package/src/hardware/unified-detector.js +30 -13
- package/src/index.js +19 -1
- package/src/models/deterministic-selector.js +4 -0
package/bin/enhanced_cli.js
CHANGED
|
@@ -881,6 +881,11 @@ function formatGpuInventoryList(models = []) {
|
|
|
881
881
|
|
|
882
882
|
// Helper function to get hardware tier for display
|
|
883
883
|
function getHardwareTierForDisplay(hardware) {
|
|
884
|
+
const canonicalTier = hardware?.summary?.hardwareTier;
|
|
885
|
+
if (typeof canonicalTier === 'string' && canonicalTier.trim()) {
|
|
886
|
+
return canonicalTier.replace(/_/g, ' ').toUpperCase();
|
|
887
|
+
}
|
|
888
|
+
|
|
884
889
|
const ram = hardware.memory.total;
|
|
885
890
|
const cores = hardware.cpu.cores;
|
|
886
891
|
const gpuModel = hardware.gpu?.model || '';
|
|
@@ -923,6 +928,21 @@ function getHardwareTierForDisplay(hardware) {
|
|
|
923
928
|
return tier;
|
|
924
929
|
}
|
|
925
930
|
|
|
931
|
+
function getBackendLabelForDisplay(hardware) {
|
|
932
|
+
const summary = hardware?.summary || {};
|
|
933
|
+
|
|
934
|
+
if (typeof summary.bestBackendLabel === 'string' && summary.bestBackendLabel.trim()) {
|
|
935
|
+
return summary.bestBackendLabel;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
const backendName = summary.backendName || String(summary.bestBackend || 'cpu').toUpperCase();
|
|
939
|
+
if (summary.runtimeBackend && summary.runtimeBackend !== summary.bestBackend) {
|
|
940
|
+
return `${backendName} + ${summary.runtimeBackendName || summary.runtimeBackend} assist`;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
return backendName;
|
|
944
|
+
}
|
|
945
|
+
|
|
926
946
|
function formatSpeed(speed) {
|
|
927
947
|
const speedMap = {
|
|
928
948
|
'very_fast': 'very_fast',
|
|
@@ -969,12 +989,13 @@ function displaySystemInfo(hardware, analysis) {
|
|
|
969
989
|
`${chalk.cyan('Architecture:')} ${hardware.cpu.architecture}`,
|
|
970
990
|
`${chalk.cyan('RAM:')} ${ramColor(hardware.memory.total + 'GB')}`,
|
|
971
991
|
`${chalk.cyan('GPU:')} ${gpuColor(hardware.gpu.model || 'Not detected')}`,
|
|
992
|
+
`${chalk.cyan('Backend:')} ${chalk.white(getBackendLabelForDisplay(hardware))}`,
|
|
972
993
|
`${chalk.cyan('VRAM:')} ${hardware.gpu.vram === 0 && hardware.gpu.model && hardware.gpu.model.toLowerCase().includes('apple') ? 'Unified Memory' : `${hardware.gpu.vram || 'N/A'}GB`}${hardware.gpu.dedicated ? chalk.green(' (Dedicated)') : chalk.hex('#FFA500')(' (Integrated)')}`,
|
|
973
994
|
`${chalk.cyan('Dedicated GPUs:')} ${chalk.green(dedicatedList)}`,
|
|
974
995
|
`${chalk.cyan('Integrated GPUs:')} ${chalk.hex('#FFA500')(integratedList)}`,
|
|
975
996
|
];
|
|
976
997
|
|
|
977
|
-
const tier = analysis.summary.hardwareTier?.replace(
|
|
998
|
+
const tier = analysis.summary.hardwareTier?.replace(/_/g, ' ').toUpperCase() || getHardwareTierForDisplay(hardware);
|
|
978
999
|
const tierColor = tier.includes('HIGH') ? chalk.green : tier.includes('MEDIUM') ? chalk.yellow : chalk.red;
|
|
979
1000
|
|
|
980
1001
|
lines.push(`${chalk.bold('Hardware Tier:')} ${tierColor.bold(tier)}`);
|
|
@@ -1758,6 +1779,7 @@ function displaySimplifiedSystemInfo(hardware) {
|
|
|
1758
1779
|
console.log(`Memory: ${chalk.white(memInfo)}`);
|
|
1759
1780
|
console.log(`GPU: ${chalk.white(gpuInfo)}`);
|
|
1760
1781
|
console.log(`Architecture: ${chalk.white(hardware.cpu.architecture)}`);
|
|
1782
|
+
console.log(`Backend: ${chalk.white(getBackendLabelForDisplay(hardware))}`);
|
|
1761
1783
|
|
|
1762
1784
|
const tier = getHardwareTierForDisplay(hardware);
|
|
1763
1785
|
const tierColor = tier.includes('HIGH') ? chalk.green : tier.includes('MEDIUM') ? chalk.yellow : chalk.red;
|
|
@@ -5058,7 +5080,7 @@ program
|
|
|
5058
5080
|
console.log(` ${detector.getHardwareDescription()}`);
|
|
5059
5081
|
console.log(` Tier: ${chalk.cyan(detector.getHardwareTier().replace('_', ' ').toUpperCase())}`);
|
|
5060
5082
|
console.log(` Max model size: ${chalk.green(detector.getMaxModelSize() + 'GB')}`);
|
|
5061
|
-
console.log(` Best backend: ${chalk.cyan(hardware
|
|
5083
|
+
console.log(` Best backend: ${chalk.cyan(getBackendLabelForDisplay(hardware))}`);
|
|
5062
5084
|
if (hardware.summary.runtimeBackend && hardware.summary.runtimeBackend !== hardware.summary.bestBackend) {
|
|
5063
5085
|
console.log(` Runtime assist: ${chalk.green(hardware.summary.runtimeBackendName || hardware.summary.runtimeBackend)}`);
|
|
5064
5086
|
}
|
package/package.json
CHANGED
|
@@ -333,9 +333,38 @@ class UnifiedDetector {
|
|
|
333
333
|
summary.effectiveMemory = Math.round(summary.systemRAM * 0.7);
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
+
summary.hardwareTier = this.classifyHardwareTierFromSummary(summary);
|
|
337
|
+
summary.bestBackendLabel = this.getBestBackendLabel(summary);
|
|
338
|
+
|
|
336
339
|
return summary;
|
|
337
340
|
}
|
|
338
341
|
|
|
342
|
+
classifyHardwareTierFromSummary(summary = {}) {
|
|
343
|
+
const effectiveMem = Number(summary.effectiveMemory) || 0;
|
|
344
|
+
const speed = Number(summary.speedCoefficient) || 0;
|
|
345
|
+
|
|
346
|
+
if (effectiveMem >= 80 && speed >= 300) return 'ultra_high'; // H100, MI300
|
|
347
|
+
if (effectiveMem >= 48 && speed >= 200) return 'very_high'; // 2x3090, 4090
|
|
348
|
+
if (effectiveMem >= 24 && speed >= 150) return 'high'; // 3090, 4090, M2 Max
|
|
349
|
+
if (effectiveMem >= 16 && speed >= 100) return 'medium_high'; // 4080, 3080, M3 Pro
|
|
350
|
+
if (effectiveMem >= 12 && speed >= 80) return 'medium'; // 3060, 4060 Ti
|
|
351
|
+
if (effectiveMem >= 8 && speed >= 50) return 'medium_low'; // 3060, M2
|
|
352
|
+
if (effectiveMem >= 6 && speed >= 30) return 'low'; // GTX 1660, iGPU
|
|
353
|
+
return 'ultra_low'; // CPU only
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
getBestBackendLabel(summary = {}) {
|
|
357
|
+
const backendName = summary.backendName || String(summary.bestBackend || 'cpu').toUpperCase();
|
|
358
|
+
if (
|
|
359
|
+
summary.hasRuntimeAssist &&
|
|
360
|
+
summary.runtimeBackend &&
|
|
361
|
+
summary.runtimeBackend !== summary.bestBackend
|
|
362
|
+
) {
|
|
363
|
+
return `${backendName} + ${summary.runtimeBackendName || summary.runtimeBackend} assist`;
|
|
364
|
+
}
|
|
365
|
+
return backendName;
|
|
366
|
+
}
|
|
367
|
+
|
|
339
368
|
summarizeGPUInventory(gpus = []) {
|
|
340
369
|
const normalized = this.normalizeGpuInventory(gpus);
|
|
341
370
|
const counts = new Map();
|
|
@@ -844,19 +873,7 @@ class UnifiedDetector {
|
|
|
844
873
|
const result = this.cache;
|
|
845
874
|
if (!result) return 'unknown';
|
|
846
875
|
|
|
847
|
-
|
|
848
|
-
const effectiveMem = summary.effectiveMemory;
|
|
849
|
-
const speed = summary.speedCoefficient;
|
|
850
|
-
|
|
851
|
-
// Tier based on effective memory and speed
|
|
852
|
-
if (effectiveMem >= 80 && speed >= 300) return 'ultra_high'; // H100, MI300
|
|
853
|
-
if (effectiveMem >= 48 && speed >= 200) return 'very_high'; // 2x3090, 4090
|
|
854
|
-
if (effectiveMem >= 24 && speed >= 150) return 'high'; // 3090, 4090, M2 Max
|
|
855
|
-
if (effectiveMem >= 16 && speed >= 100) return 'medium_high'; // 4080, 3080, M3 Pro
|
|
856
|
-
if (effectiveMem >= 12 && speed >= 80) return 'medium'; // 3060, 4060 Ti
|
|
857
|
-
if (effectiveMem >= 8 && speed >= 50) return 'medium_low'; // 3060, M2
|
|
858
|
-
if (effectiveMem >= 6 && speed >= 30) return 'low'; // GTX 1660, iGPU
|
|
859
|
-
return 'ultra_low'; // CPU only
|
|
876
|
+
return result.summary?.hardwareTier || this.classifyHardwareTierFromSummary(result.summary);
|
|
860
877
|
}
|
|
861
878
|
|
|
862
879
|
/**
|
package/src/index.js
CHANGED
|
@@ -1345,9 +1345,27 @@ class LLMChecker {
|
|
|
1345
1345
|
}
|
|
1346
1346
|
|
|
1347
1347
|
getHardwareTier(hardware) {
|
|
1348
|
+
const canonicalTier = hardware?.summary?.hardwareTier;
|
|
1349
|
+
if (typeof canonicalTier === 'string' && canonicalTier.trim()) {
|
|
1350
|
+
return canonicalTier.trim().toLowerCase().replace(/\s+/g, '_');
|
|
1351
|
+
}
|
|
1348
1352
|
return this.calculateHardwareScore(hardware).tier;
|
|
1349
1353
|
}
|
|
1350
1354
|
|
|
1355
|
+
getHardwareTierBucket(hardware) {
|
|
1356
|
+
const tier = this.getHardwareTier(hardware);
|
|
1357
|
+
switch (tier) {
|
|
1358
|
+
case 'very_high':
|
|
1359
|
+
return 'ultra_high';
|
|
1360
|
+
case 'medium_high':
|
|
1361
|
+
return 'high';
|
|
1362
|
+
case 'medium_low':
|
|
1363
|
+
return 'low';
|
|
1364
|
+
default:
|
|
1365
|
+
return tier;
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1351
1369
|
calculateHardwareScore(hardware) {
|
|
1352
1370
|
const clamp = (x, a = 0, b = 1) => Math.max(a, Math.min(b, x));
|
|
1353
1371
|
|
|
@@ -2003,7 +2021,7 @@ class LLMChecker {
|
|
|
2003
2021
|
score -= 15;
|
|
2004
2022
|
}
|
|
2005
2023
|
|
|
2006
|
-
const hardwareTier = this.
|
|
2024
|
+
const hardwareTier = this.getHardwareTierBucket(hardware);
|
|
2007
2025
|
switch (hardwareTier) {
|
|
2008
2026
|
case 'ultra_high':
|
|
2009
2027
|
score += 15;
|
|
@@ -2141,6 +2141,10 @@ class DeterministicModelSelector {
|
|
|
2141
2141
|
|
|
2142
2142
|
mapHardwareTier(hardware = {}) {
|
|
2143
2143
|
const summary = hardware?.summary || {};
|
|
2144
|
+
const canonicalTier = summary.hardwareTier || summary.hardware_tier;
|
|
2145
|
+
if (typeof canonicalTier === 'string' && canonicalTier.trim()) {
|
|
2146
|
+
return canonicalTier.trim().toLowerCase().replace(/\s+/g, '_');
|
|
2147
|
+
}
|
|
2144
2148
|
const effectiveMemory = Number(summary.effectiveMemory);
|
|
2145
2149
|
const speedCoefficient = Number(summary.speedCoefficient);
|
|
2146
2150
|
if (Number.isFinite(effectiveMemory) && effectiveMemory > 0 && Number.isFinite(speedCoefficient)) {
|