Skip to content

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.

fix(models): a 0.17 GB LoRA stops being too big for a 12 GB card

purplec2db68773e21
diff --git a/src/components/models/DiscoverModels.tsx b/src/components/models/DiscoverModels.tsx
index 34b18a6b..f7f16b70 100644
--- a/src/components/models/DiscoverModels.tsx
+++ b/src/components/models/DiscoverModels.tsx
@@ -13,7 +13,7 @@ import {
type DiscoverModel, type DownloadProgress, type ModelBundle, type CivitAIModelResult, type HfGgufFile,
} from '../../api/discover'
import { getSystemVRAM } from '../../api/comfyui'
-import { getMaxVramGb, getTotalRamGb } from '../../lib/hardware'
+import { getMaxVramGb, getTotalRamGb, bundleVramNeedGb } from '../../lib/hardware'
import { openExternal } from '../../api/backend'
import { useModels } from '../../hooks/useModels'
import { useDownloadStore } from '../../stores/downloadStore'
@@ -148,21 +148,12 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
const isVideo = category === 'video'
const bundles = isImage ? getImageBundles() : isVideo ? getVideoBundles() : []
- // Parse VRAM requirement string to minimum GB needed
- // "6-8 GB" → 8 (need at least the upper bound)
- // "12+ GB" → 13 (+ means MORE than that number)
- // "8 GB" → 8
- const parseVRAM = (s: string): number => {
- if (s.includes('+')) {
- const match = s.match(/(\d+)\+/)
- return match ? parseInt(match[1]) + 2 : 99 // "12+" means realistically 14+ GB needed
- }
- // Range like "6-8 GB" → take the upper number
- const range = s.match(/(\d+)\s*-\s*(\d+)/)
- if (range) return parseInt(range[2])
- const match = s.match(/(\d+)/)
- return match ? parseInt(match[1]) : 99
- }
+ // How much VRAM a bundle wants, read by the ONE shared parser in
+ // lib/hardware. The local copy that used to live here answered 99 GB to the
+ // add-on bundles, whose requirement reads "any", so the sort buried them,
+ // the tier filter hid them and the tile called a 0.17 GB LoRA too big for a
+ // 12 GB card.
+ const parseVRAM = (b: ModelBundle): number => bundleVramNeedGb(b)
// Sort bundles: verified first, then HOT, then fits VRAM, then by size
const sortedBundles = [...bundles].sort((a, b) => {
@@ -173,12 +164,12 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
if (a.hot && !b.hot) return -1
if (!a.hot && b.hot) return 1
if (systemVRAM) {
- const aFits = parseVRAM(a.vramRequired) <= systemVRAM
- const bFits = parseVRAM(b.vramRequired) <= systemVRAM
+ const aFits = parseVRAM(a) <= systemVRAM
+ const bFits = parseVRAM(b) <= systemVRAM
if (aFits && !bFits) return -1
if (!aFits && bFits) return 1
}
- return parseVRAM(a.vramRequired) - parseVRAM(b.vramRequired)
+ return parseVRAM(a) - parseVRAM(b)
})
const tabFilteredBundles = sortedBundles.filter(b => subTab === 'uncensored' ? b.uncensored : !b.uncensored)
@@ -186,7 +177,7 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
// VRAM tier filtering for bundles
const vramFilteredBundles = tabFilteredBundles.filter(b => {
if (vramTier === 'all') return true
- const vram = parseVRAM(b.vramRequired)
+ const vram = parseVRAM(b)
if (vramTier === 'fit') return systemVRAM ? vram <= systemVRAM + 2 : true
if (vramTier === 'ultra') return vram <= 4
if (vramTier === 'light') return vram > 4 && vram <= 10
@@ -767,7 +758,6 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
onRetry={() => retryBundle(bundle)}
onClear={() => clearBundle(bundle)}
onOpenUrl={(u) => openExternal(u)}
- parseVRAM={parseVRAM}
/>
</motion.div>
))}
diff --git a/src/components/models/ModelTiles.tsx b/src/components/models/ModelTiles.tsx
index c6f47c61..a1f193a9 100644
--- a/src/components/models/ModelTiles.tsx
+++ b/src/components/models/ModelTiles.tsx
@@ -10,6 +10,7 @@ import {
} from 'lucide-react'
import type { DiscoverModel, DownloadProgress, ModelBundle } from '../../api/discover'
import { formatBytes } from '../../lib/formatters'
+import { bundleVramNeedGb } from '../../lib/hardware'
// ─── Hardware fit ───────────────────────────────────────────────────
@@ -303,10 +304,9 @@ export interface BundleTileProps {
onRetry: () => void
onClear: () => void
onOpenUrl: (url: string) => void
- parseVRAM: (s: string) => number
}
-export function BundleTile({ bundle, vramGb, complete, downloading, hasErrors, onInstall, onRetry, onClear, onOpenUrl, parseVRAM }: BundleTileProps) {
+export function BundleTile({ bundle, vramGb, complete, downloading, hasErrors, onInstall, onRetry, onClear, onOpenUrl }: BundleTileProps) {
// No COMING SOON overlay any more (2026-07-24). It was driven by
// `!bundle.verified && !complete`, a hand-set boolean, and it dimmed the tile
// behind a full-cover "COMING SOON" pill while that tile's own working
@@ -319,7 +319,9 @@ export function BundleTile({ bundle, vramGb, complete, downloading, hasErrors, o
// wrapper-node-names pins every node name the builder emits against real
// wrapper registries. A lane that cannot run gets pulled (see the CogVideoX
// and Pyramid Flow removals) rather than shipped behind a badge.
- const need = parseVRAM(bundle.vramRequired)
+ // bundleVramNeedGb, not a local parser: the add-on bundles say "any" and the
+ // old local one answered 99 GB to that, which painted a 0.17 GB LoRA red.
+ const need = bundleVramNeedGb(bundle)
const fit: Fit = !vramGb ? 'unknown' : need <= vramGb ? 'fits' : need <= vramGb + 2 ? 'tight' : 'big'
return (
diff --git a/src/lib/__tests__/bundle-vram-need.test.ts b/src/lib/__tests__/bundle-vram-need.test.ts
new file mode 100644
index 00000000..f2b26169
--- /dev/null
+++ b/src/lib/__tests__/bundle-vram-need.test.ts
@@ -0,0 +1,67 @@
+import { describe, it, expect } from 'vitest'
+import { bundleVramNeedGb } from '../hardware'
+import { getImageBundles, getVideoBundles } from '../../api/discover'
+
+// Counter-check on the Windows box, 2026-08-29, 12 GB card: "SDXL VAE
+// (fp16-fix) · addon" (0.33 GB) and "Pixel Art XL · SDXL LoRA" (0.17 GB) both
+// carried the red dot and the label "Too big for your GPU". Their requirement
+// string is "any", the old parser found no digit in it and answered 99 GB.
+//
+// The tile's own verdict is `!vram ? unknown : need <= vram ? fits : need <=
+// vram + 2 ? tight : big`, so these cases pin the number that verdict reads.
+
+const fitOnGpu = (needGb: number, vramGb: number) =>
+ needGb <= vramGb ? 'fits' : needGb <= vramGb + 2 ? 'tight' : 'big'
+
+describe('bundleVramNeedGb — what a bundle really asks of the GPU', () => {
+ it('reads the upper bound of a range', () => {
+ expect(bundleVramNeedGb({ vramRequired: '6-8 GB', totalSizeGB: 2.8 })).toBe(8)
+ expect(bundleVramNeedGb({ vramRequired: '10-12 GB', totalSizeGB: 14 })).toBe(12)
+ })
+
+ it('reads a plus as two GB more than the number', () => {
+ expect(bundleVramNeedGb({ vramRequired: '12+ GB', totalSizeGB: 16.6 })).toBe(14)
+ expect(bundleVramNeedGb({ vramRequired: '24+ GB', totalSizeGB: 40 })).toBe(26)
+ })
+
+ it('reads a plain number, prose around it included', () => {
+ expect(bundleVramNeedGb({ vramRequired: '24 GB', totalSizeGB: 24 })).toBe(24)
+ expect(bundleVramNeedGb({ vramRequired: '16 GB best, offloads on less', totalSizeGB: 20 })).toBe(16)
+ })
+
+ it('"any" falls back to the download size, not to a made up ceiling', () => {
+ expect(bundleVramNeedGb({ vramRequired: 'any', totalSizeGB: 0.33 })).toBe(0.33)
+ expect(bundleVramNeedGb({ vramRequired: 'any', totalSizeGB: 0.17 })).toBe(0.17)
+ })
+
+ it('a missing requirement and a missing size still yield a number', () => {
+ expect(bundleVramNeedGb({})).toBe(0)
+ expect(bundleVramNeedGb({ vramRequired: '' })).toBe(0)
+ })
+
+ it('the two add-ons stop reading "Too big for your GPU" on a 12 GB card', () => {
+ const image = getImageBundles()
+ const vae = image.find(b => b.name === 'SDXL VAE (fp16-fix) · addon')!
+ const lora = image.find(b => b.name === 'Pixel Art XL · SDXL LoRA')!
+ expect(vae).toBeTruthy()
+ expect(lora).toBeTruthy()
+ expect(fitOnGpu(bundleVramNeedGb(vae), 12)).toBe('fits')
+ expect(fitOnGpu(bundleVramNeedGb(lora), 12)).toBe('fits')
+ // And on the smallest card we ship hints for.
+ expect(fitOnGpu(bundleVramNeedGb(vae), 4)).toBe('fits')
+ expect(fitOnGpu(bundleVramNeedGb(lora), 4)).toBe('fits')
+ })
+
+ it('a genuinely huge bundle still reads big on a 12 GB card', () => {
+ const all = [...getImageBundles(), ...getVideoBundles()]
+ const heavy = all.find(b => b.vramRequired.includes('24'))!
+ expect(heavy).toBeTruthy()
+ expect(fitOnGpu(bundleVramNeedGb(heavy), 12)).toBe('big')
+ })
+
+ it('no catalogue bundle answers with the old 99 GB placeholder', () => {
+ for (const b of [...getImageBundles(), ...getVideoBundles()]) {
+ expect(bundleVramNeedGb(b), b.name).toBeLessThan(99)
+ }
+ })
+})
diff --git a/src/lib/hardware.ts b/src/lib/hardware.ts
index fbcf9b22..3fec9317 100644
--- a/src/lib/hardware.ts
+++ b/src/lib/hardware.ts
@@ -57,3 +57,38 @@ export async function isImageGenCapable(): Promise<boolean> {
const [vram, ram] = await Promise.all([getMaxVramGb(), getTotalRamGb()]);
return meetsImageGenThreshold(vram, ram);
}
+
+// ─── Bundle VRAM requirement ────────────────────────────────────────
+
+/** What a media bundle's `vramRequired` string is worth in GB.
+ *
+ * The catalogue writes this field for humans: "6-8 GB", "12+ GB",
+ * "16 GB best, offloads on less", and for the small add-ons simply "any".
+ * The old reader took the first number it found and fell back to 99 when it
+ * found none, so "any" meant 99 GB and the two add-ons (a 0.33 GB SDXL VAE
+ * and a 0.17 GB LoRA) were stamped "Too big for your GPU" on a 12 GB card
+ * (counter-check on the Windows box, 2026-08-29). A number the catalogue
+ * never wrote is not a reason to call a 170 MB LoRA too big.
+ *
+ * Order of trust: the number in the string, then the bundle's own download
+ * size (weights on disk are the honest floor for weights in VRAM), then 0,
+ * which reads as "nothing here says this will not fit" and only ever drives
+ * a hint, never a gate.
+ *
+ * - "6-8 GB" -> 8 (the upper bound is what it really wants)
+ * - "12+ GB" -> 14 (a plus means more than the number)
+ * - "8 GB" -> 8
+ * - "any" -> the bundle size, e.g. 0.33
+ */
+export function bundleVramNeedGb(bundle: { vramRequired?: string; totalSizeGB?: number }): number {
+ const s = bundle.vramRequired ?? ''
+ if (s.includes('+')) {
+ const plus = s.match(/(\d+)\+/)
+ if (plus) return parseInt(plus[1]) + 2
+ }
+ const range = s.match(/(\d+)\s*-\s*(\d+)/)
+ if (range) return parseInt(range[2])
+ const single = s.match(/(\d+)/)
+ if (single) return parseInt(single[1])
+ return bundle.totalSizeGB ?? 0
+}