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

Function planOffload

src/setup/offload-detect.ts:96–103  ·  view source on GitHub ↗
(opts: { baseUrl: string; model: string; vramBudgetGB?: number })

Source from the content-addressed store, hash-verified

94/** Gather hardware + model facts and compute an offload plan. Returns null when anything needed
95 * is unavailable (so the caller can say "couldn't auto-detect — set num_gpu manually"). */
96export async function planOffload(opts: { baseUrl: string; model: string; vramBudgetGB?: number }): Promise<OffloadSuggestion | null> {
97 const vramGB = opts.vramBudgetGB ?? detectVramGB();
98 if (!vramGB) return null;
99 const facts = await fetchOllamaModelFacts(opts.baseUrl, opts.model);
100 if (!facts) return null;
101 const plan = suggestGpuLayers({ modelSizeGB: facts.modelSizeGB, vramBudgetGB: vramGB, totalLayers: facts.totalLayers });
102 return { plan, facts, vramGB };
103}

Callers 2

index.tsFile · 0.85
dispatchActionFunction · 0.85

Calls 3

detectVramGBFunction · 0.85
fetchOllamaModelFactsFunction · 0.85
suggestGpuLayersFunction · 0.85

Tested by

no test coverage detected