The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(models): no imatrix file as a model, the image part counts (D7)
purpleb42c973517ba
diff --git a/src/api/__tests__/a-guessed-quant-fits-the-card.test.tsx b/src/api/__tests__/a-guessed-quant-fits-the-card.test.tsxindex 069b4cf3..2c171fa4 100644--- a/src/api/__tests__/a-guessed-quant-fits-the-card.test.tsx+++ b/src/api/__tests__/a-guessed-quant-fits-the-card.test.tsx@@ -84,6 +84,29 @@ describe('a search hit with a guessed quant', () => {expect(picked?.overBudget).toBe(true)})+ it('a repo with only imatrix files and IQ3 quants (the report\'s own repo) gets the IQ3, not 26 MB of calibration data', () => {+ const tree: HfTreeEntry[] = [+ { type: 'file', path: 'abliterated-imatrix1.gguf', size: 26_000_000 },+ { type: 'file', path: 'abliterated-imatrix2.gguf', size: 26_000_000 },+ { type: 'file', path: 'M-27B-Coder-abliterated-IQ3_S1.gguf', size: 12.1 * GB },+ { type: 'file', path: 'M-27B-Coder-abliterated-bf16.gguf', size: 54.6 * GB },+ ]+ expect(selectGgufFromTree(tree, REPO, 'Q4_K_M', undefined, BUDGET_16)?.files[0].filename).toBe('M-27B-Coder-abliterated-IQ3_S1.gguf')+ // Without a known memory the fallback still takes a quant, never the imatrix.+ expect(selectGgufFromTree(tree, REPO, 'Q4_K_M')?.files[0].filename).toBe('M-27B-Coder-abliterated-IQ3_S1.gguf')+ expect(defaultChoice(ggufChoicesFromTree(tree))?.path).toBe('M-27B-Coder-abliterated-IQ3_S1.gguf')+ })++ it('the image part the repository ships takes from the same room', () => {+ const tree = [...TREE, { type: 'file', path: 'mmproj-F16.gguf', size: 1.9 * GB }]+ // 14.4 GiB budget minus 1.9 GB of image part leaves about 13.6 GB: the+ // 12.9 GB Q3_K_M still fits, a 14.2 GB file would not any more.+ expect(selectGgufFromTree(tree, REPO, 'Q4_K_M', undefined, BUDGET_16)?.quant).toBe('Q3_K_M')+ const tight = [...tree, file('IQ4_XS', 14.2)]+ expect(selectGgufFromTree(tight, REPO, 'Q4_K_M', undefined, BUDGET_16)?.quant).toBe('Q3_K_M')+ expect(selectGgufFromTree([...TREE, file('IQ4_XS', 14.2)], REPO, 'Q4_K_M', undefined, BUDGET_16)?.quant).toBe('IQ4_XS')+ })+it('a file the caller names is never swapped, however big', () => {const named = selectGgufFromTree(TREE, REPO, 'Q4_K_M', TREE[3].path, BUDGET_16)expect(named?.quant).toBe('Q4_K_L')diff --git a/src/api/discover.ts b/src/api/discover.tsindex a8159ca8..a5543ff2 100644--- a/src/api/discover.ts+++ b/src/api/discover.ts@@ -1830,6 +1830,9 @@ export function selectGgufFromTree((wanted ? complete.find(byQuant) || all.find(byQuant) : undefined) ||(wanted ? complete.find(byKey) || all.find(byKey) : undefined) ||complete.find(g => g.quant === 'Q4_K_M') ||+ // A file without a quant in its name (`…-imatrix1.gguf`, 26 MB of+ // calibration data) is no model to fall back on while a quant is there.+ complete.find(g => g.quant) ||complete[0] ||all[0]if (!picked) return null@@ -1838,16 +1841,18 @@ export function selectGgufFromTree(// taken from the list by size instead: the largest one that fits.let fitSwap: HfGgufResolution['fitSwap']let overBudget = false- if (!named && budgetBytes && budgetBytes > 0 && !picked.gap) {+ // The image part loads next to the model, so it takes from the same room.+ const room = budgetBytes ? budgetBytes - (upstreamPart?.size || upstreamPart?.lfs?.size || 0) : 0+ if (!named && room > 0 && !picked.gap) {const pickedBytes = groupBytes(picked)- if (pickedBytes > budgetBytes) {+ if (pickedBytes > room || !picked.quant) {const fitting = complete- .filter(g => g.quant && groupBytes(g) > 0 && groupBytes(g) <= budgetBytes)+ .filter(g => g.quant && groupBytes(g) > 0 && groupBytes(g) <= room).sort((a, b) => groupBytes(b) - groupBytes(a))[0]if (fitting) {- fitSwap = { from: picked.quant ?? picked.key, fromBytes: pickedBytes }+ if (pickedBytes > room) fitSwap = { from: picked.quant ?? picked.key, fromBytes: pickedBytes }picked = fitting- } else {+ } else if (pickedBytes > room) {overBudget = true}}diff --git a/src/lib/hf-link.ts b/src/lib/hf-link.tsindex 92ac21f8..eaf9ef40 100644--- a/src/lib/hf-link.ts+++ b/src/lib/hf-link.ts@@ -146,7 +146,7 @@ export function defaultChoice(choices: readonly HfLinkChoice[], budgetBytes?: nu.sort((a, b) => b.bytes - a.bytes)[0]if (fitting) return fitting}- return loadable.find((c) => c.quant === 'Q4_K_M') ?? loadable[0] ?? choices[0] ?? null+ return loadable.find((c) => c.quant === 'Q4_K_M') ?? loadable.find((c) => c.quant) ?? loadable[0] ?? choices[0] ?? null}/** D7: the words after a file that will not fit fully in graphics memory. */