MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / isModelComfortableForHardware

Function isModelComfortableForHardware

src/setup/wizard.ts:488–501  ·  view source on GitHub ↗

Whether a given model id is comfortable on this hardware. Heuristic.

(modelId: string, hw: HardwareProfile)

Source from the content-addressed store, hash-verified

486
487/** Whether a given model id is comfortable on this hardware. Heuristic. */
488function isModelComfortableForHardware(modelId: string, hw: HardwareProfile): boolean {
489 // Parse size from common patterns: qwen2.5-coder:32b, mixtral:8x22b, deepseek-v3 (~671B)
490 const colonMatch = modelId.match(/:(\d+(?:\.\d+)?)b/i);
491 const xMatch = modelId.match(/(\d+)x(\d+)b/i);
492 let approxB = 0;
493 if (colonMatch) approxB = parseFloat(colonMatch[1]!);
494 else if (xMatch) approxB = parseInt(xMatch[1]!, 10) * parseInt(xMatch[2]!, 10) * 0.3; // MoE active params heuristic
495 else if (/v3$/i.test(modelId)) approxB = 50; // DeepSeek-V3 MoE: ~37B active
496 else if (/72b/.test(modelId)) approxB = 72;
497 // Rough GB needed at q4 quantization
498 const gbNeeded = approxB * 0.6;
499 const available = hw.gpu.vramGb ?? hw.ramGb;
500 return gbNeeded < available * 0.7;
501}
502
503/**
504 * Build the sub-agent model choices when the user picks "lighter local".

Callers 1

buildModelChoicesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected