(opts: { baseUrl: string; model: string; vramBudgetGB?: number })
| 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"). */ |
| 96 | export 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 | } |
no test coverage detected