mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-08 10:46:06 +00:00
* fix(media-use): repoint the dead videogen tier, demote past unusable models
`LOCAL_MODELS.videogen`'s `large` tier named `dgrauet/ltx-2.3-mlx-bf16`, which
returns HTTP 401 and cannot be downloaded at all. It was not a dormant entry:
`rankedByPreference` sorts by descending `needs.ramMB` when no `rank` is set,
so the largest fitting tier is tried FIRST by design. Any machine clearing
32 GB *available* RAM selected the dead entry, `ltxVideoGenerate` caught the
failure and returned a bare `null`, and since `ltx.local` is last in
`["heygen.video", "ltx.local"]` and network providers are skipped under
`--local-only` (`registry.mjs:206`), local video generation failed outright
instead of falling back to the tier that works.
It survived review because the table landed with "live verification on a 24GB
M-series Mac" - and a 24 GB machine cannot select a 32 GB tier, so that entry
was unreachable on the only machine that validated it. The unit fixtures
inherit the same ceiling (`fittingSpecs` is 20000MB), so every existing test
exercised the medium tier alone.
Two changes:
1. Repoint to `dgrauet/ltx-2.3-mlx-q8` (reachable) and correct `sizeMB` from
45000 to 28800. Measured against the HF API: the q8 repo totals 87.5 GB,
and the registry's own targeted `--include` subset is 28.76 GB. That
matches the sibling q4 entry's convention (`sizeMB: 20000` vs a measured
19.48 GB subset), so 45000 was wrong under either reading. `--low-ram` is
added because the entry's own note calls it required at this tier's 32 GB
floor, and the invoke omitted it.
2. A repoint alone is one bad URL from a repeat, so add the missing recovery.
`selectModelLadder` returns every fitting model best-first;
`selectModel`'s pick is now defined as that list's head. All three sites
that previously selected exactly one model and failed terminally walk the
ladder instead, demoting past a tier that cannot run here - gated weights,
runner off PATH, an OOM at a tier that nominally fits:
- `ltx-video-provider.mjs` (videogen, the reported failure)
- `mflux-provider.mjs` (imagegen - same shape, and its 32 GB/64 GB tiers
are equally unverifiable on a 24 GB machine)
- `local-run.mjs` (tts/asr/upscale - `fish-speech` missing should still
get you Kokoro)
Every demotion is logged rather than silent, so a quietly smaller model is
never mistaken for the tier the machine nominally qualified for.
Also fixes the `install` string both videogen entries share: it ended at
`uv sync --all-extras`, which leaves the entry point in `.venv/bin`, so the
"`ltx-2-mlx` not on PATH" hint named a command that following the instruction
would not put on PATH.
The q8 tier is NOT live-verified - no 32 GB+ Apple Silicon machine was
available - and its notes say so. Shipping it unverified is safe precisely
because of change 2: a wrong tier now costs one failed attempt, not the whole
local path.
- Rames Jusso
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(media-use): report the real videogen download size, disclose it, discard failed partials
Addresses review feedback on #3509 (CHANGES_REQUESTED at 90df164a), plus the
follow-on ask to tell the user what a download costs before they accept it.
1. `sizeMB` described a targeted `--include` subset that no run ever gets.
Both videogen invokes pass a repo id to `--model`, and upstream
`resolve_model_dir()` (`ltx_pipelines_mlx/utils/_orchestration.py:35-40`)
calls `snapshot_download(repo)` with no `allow_patterns`, so the full repo
lands regardless of what was pre-fetched. Corrected to measured repo
totals: q8 87500 (87,511,991,375 B) and q4 59700 (59,686,429,583 B). q4 was
wrong the same way at 20000, so both are fixed together rather than leaving
one convention on each side.
My earlier claim that 28800 "matches the sibling q4 entry's convention" was
wrong in the way that matters: the convention itself described a subset the
runner does not honor. The file's own comment already said "blind
snapshot-downloads the lot (60 GB q4, 88 GB q8)" three lines above the
fields that contradicted it, and the original report measured it too ("the
q4 cache ended at 56 GB and q8 at 82 GB"), which reconciles exactly once
read as GiB: 59.69 GB = 55.6 GiB, 87.51 GB = 81.5 GiB. So the download is
the complete repo both times, not a partial fetch.
Removed the `--include` recipe rather than repairing it: it is ineffective
(the runner refetches at generate time) and insufficient (`--two-stage` is
"dev model + CFG at half-res, upscale, distilled LoRA refine" per upstream's
own help text, so it needs transformer-dev AND transformer-distilled AND
spatial_upscaler_x2; `--distilled` needs an upscaler too). The q4 tier
verified on a 24 GB Mac only worked BECAUSE the download is unfiltered.
2. Nothing told the user what they were agreeing to before a tool started
pulling tens of GB. `describeDownload()` in `specs.mjs` names the size and
the directory the weights land in, and checks free space with `statfs`
against that directory rather than cwd, since the weights do not land in
cwd. A tier that will not fit is still offered, with a plain statement that
it will not fit: hiding it would make a machine that could free up space
look like it has no large tier. Unknown free space reports as unknown, not
as zero. Wired into both providers' install hints, the `runLocalModel`
install payload (now carrying `sizeMB`), and `describeModelLadder`.
3. Each retry attempt mints its own timestamped temp path, so a partial
artifact from a failed tier was orphaned rather than overwritten, and a
lower tier then succeeding hid it. Both providers discard the partial before
demoting, guarded so a file that cannot be removed never masks the generate
failure it came from. Video is the material case: a partial mp4 is large.
`local-run.mjs` is deliberately unchanged here. Its `out` is caller-provided
and identical across attempts, so a partial is overwritten rather than
orphaned, and unlinking a path the caller named would be a footgun. The rule
the two providers follow is: clean up what you allocate.
Tests: 553/553 across `skills/**/*.test.mjs` (+15). New coverage pins the
cleanup (failed tier's partial removed, returned artifact survives, one discard
per attempt on the all-fail path, an unremovable partial still surfaces the
real failure) and the disclosure (cache-dir precedence, statfs walk-up to the
deepest existing ancestor, unknown-vs-zero, and the will-not-fit wording).
Every new guard mutation-tested: removing any one of them turns tests red.
- Rames Jusso
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
319 lines
16 KiB
JavaScript
319 lines
16 KiB
JavaScript
// Declarative table of USER-INSTALLED local models, for the spec-gated fallback.
|
|
//
|
|
// These models run on the user's own machine for their own use; media-use
|
|
// recommends, spec-checks, and assists install; it does not bundle, redistribute,
|
|
// or sell them. Because nothing is redistributed, selection is purely by
|
|
// quality / size / spec-fit / word-timestamp support (there is deliberately NO
|
|
// license field gating availability).
|
|
//
|
|
// Tiers (`small`|`medium`|`large`|`xlarge`) are human labels; `needs.ramMB` is
|
|
// what selection actually gates on. selectModel() returns the best model that
|
|
// fits the machine's AVAILABLE RAM, best-first: by explicit `rank` when set
|
|
// (quality that is NOT size, e.g. ASR), else by RAM footprint (the quality
|
|
// proxy for generation). No fit -> recommend the CLI/cloud path.
|
|
//
|
|
// selectModelLadder() returns EVERY fitting model in that same order. Callers
|
|
// that can retry walk it so ONE unusable entry (gated weights, a missing
|
|
// binary, an OOM) demotes to the next tier instead of killing the local path.
|
|
//
|
|
// Picks reflect the 2026 research pass, verified live where noted.
|
|
|
|
export const CAPABILITIES = ["tts", "asr", "upscale", "videogen", "imagegen"];
|
|
|
|
const MODELS = {
|
|
tts: [
|
|
{
|
|
id: "kokoro",
|
|
tier: "medium",
|
|
sizeMB: 330,
|
|
needs: { ramMB: 2048, gpu: false },
|
|
wordTimestamps: "native",
|
|
install: "pip install kokoro",
|
|
invoke: "python -m kokoro --text {text} --voice {voice} --out {out}",
|
|
notes: "CPU, faster-than-realtime, native per-word timestamps. Default floor.",
|
|
},
|
|
{
|
|
id: "fish-speech",
|
|
tier: "large",
|
|
sizeMB: 1100,
|
|
needs: { ramMB: 16000, gpu: true, vramMB: 12000 },
|
|
wordTimestamps: "whisperx", // needs forced alignment (run ASR over output)
|
|
install: "pip install fish-speech",
|
|
invoke: "fish-speech synth --text {text} --ref {ref} --out {out}",
|
|
notes: "Expressive zero-shot voice cloning; meeting pick. WhisperX for word timing.",
|
|
},
|
|
],
|
|
asr: [
|
|
// Parakeet is BETTER than Whisper yet SMALLER (0.6B vs 1.5B), so quality is
|
|
// not size here: `rank` pins it ahead of whisper regardless of footprint.
|
|
// Open ASR Leaderboard avg WER: Parakeet ~6.05% vs whisper-large-v3 7.44%
|
|
// (~19% better); on NOISY test-other 4.73% vs 5.96%, and whisper-v3
|
|
// hallucinated to 308% WER on meetings where Parakeet held. 5-10x faster.
|
|
//
|
|
// Cohere Transcribe 2B tops the leaderboard (5.42%) and is nominally the most
|
|
// accurate, but its mlx-audio community MLX quants (4bit AND 8bit, with and
|
|
// without --language en) produced multilingual token-soup garbage AND ran
|
|
// 40-70x slower than Parakeet on a 24GB Mac (live-tested 2026-07). Excluded
|
|
// until the mlx-audio Cohere decoder stabilizes; Parakeet is the default.
|
|
{
|
|
id: "parakeet-mlx",
|
|
tier: "small",
|
|
rank: 0,
|
|
sizeMB: 2400,
|
|
needs: { ramMB: 4000, gpu: true },
|
|
wordTimestamps: "tokens", // sub-word tokens; merged to words by parakeet-words.mjs
|
|
repo: "mlx-community/parakeet-tdt-0.6b-v3",
|
|
install:
|
|
"uv venv ~/.venvs/parakeet && VIRTUAL_ENV=~/.venvs/parakeet uv pip install parakeet-mlx",
|
|
invoke:
|
|
"parakeet-mlx {audio} --model mlx-community/parakeet-tdt-0.6b-v3 --output-format json --output-dir {outdir}",
|
|
notes:
|
|
"NVIDIA Parakeet-TDT 0.6B via parakeet-mlx. VERIFIED on 24GB: accurate transcript, ~3s (cached model) for 8s audio, word timestamps drive transcript-cut. English + 25 European languages. Beats whisper.cpp on accuracy (6.05% vs 7.44% WER) AND speed (5-10x).",
|
|
},
|
|
{
|
|
id: "whisperx",
|
|
tier: "medium",
|
|
rank: 1,
|
|
sizeMB: 1500,
|
|
needs: { ramMB: 4096, gpu: false },
|
|
wordTimestamps: "native", // faster-whisper + wav2vec2 forced alignment
|
|
install: "pip install whisperx",
|
|
invoke: "whisperx {audio} --output_format json --out {out}",
|
|
notes:
|
|
"CPU-only fallback (no GPU): faster-whisper + wav2vec2 forced alignment, native word timestamps. The packaged `hyperframes transcribe` (whisper.cpp) is the zero-setup baseline below this.",
|
|
},
|
|
],
|
|
upscale: [
|
|
{
|
|
id: "real-esrgan",
|
|
tier: "medium",
|
|
sizeMB: 70,
|
|
needs: { ramMB: 2048, gpu: false },
|
|
wordTimestamps: false,
|
|
install: "brew install real-esrgan-ncnn-vulkan # or download the ncnn binary",
|
|
invoke: "realesrgan-ncnn-vulkan -i {in} -o {out} -s 4",
|
|
notes: "ncnn-vulkan binary, CPU-capable. GFPGAN for faces.",
|
|
},
|
|
{
|
|
id: "seedvr2",
|
|
tier: "large",
|
|
sizeMB: 6000,
|
|
needs: { ramMB: 24000, gpu: true, vramMB: 16000 },
|
|
wordTimestamps: false,
|
|
install: "pip install seedvr2",
|
|
invoke: "seedvr2 upscale --in {in} --out {out}",
|
|
notes: "Diffusion upscaler, GPU-only. Video2X for video.",
|
|
},
|
|
],
|
|
videogen: [
|
|
// 2026-07 X research pass + live verification on a 24GB M-series Mac -
|
|
// which reaches the q4 tier only: a 24GB machine cannot select the 32GB
|
|
// entry below it, so that tier's claims stay unverified until someone
|
|
// runs it on a 32GB+ machine.
|
|
// The Mac-local video story is LTX 2.3 on MLX via dgrauet/ltx-2-mlx (the
|
|
// pipeline these weights were converted for; also powers Phosphene).
|
|
// Wan 2.x MLX exists only as A14B conversions (too large for consumer
|
|
// unified memory); revisit when a 5B Wan MLX conversion lands.
|
|
// IMPORTANT: sizeMB below is the FULL repo, because that is what a run
|
|
// actually downloads. Both invokes pass a repo id to `--model`, and
|
|
// upstream resolve_model_dir() (ltx_pipelines_mlx/utils/_orchestration.py)
|
|
// calls snapshot_download(repo) with no allow_patterns - so the whole repo
|
|
// lands regardless of what you pre-fetched. A targeted `hf download
|
|
// --include` subset used to be documented here; it was removed because it
|
|
// is both ineffective (the runner refetches the rest at generate time) and
|
|
// insufficient (--two-stage needs transformer-dev AND transformer-distilled
|
|
// AND the x2 spatial upscaler; --distilled needs an upscaler too). The q4
|
|
// tier verified below only worked BECAUSE the download is unfiltered.
|
|
{
|
|
id: "ltx-2.3-mlx-q4",
|
|
tier: "medium",
|
|
sizeMB: 59700, // full repo, measured 59.69GB; gemma-3-12b-4bit text encoder adds ~7GB
|
|
needs: { ramMB: 16384, gpu: true },
|
|
wordTimestamps: false,
|
|
install:
|
|
'git clone https://github.com/dgrauet/ltx-2-mlx && cd ltx-2-mlx && uv sync --all-extras && export PATH="$PWD/.venv/bin:$PATH"',
|
|
invoke:
|
|
"ltx-2-mlx generate --prompt {prompt} --distilled --low-ram --model dgrauet/ltx-2.3-mlx-q4 --width {w} --height {h} --frames {frames} --frame-rate 24 --output {out}",
|
|
notes:
|
|
"LTX 2.3 int4 on MLX. Verified on 24GB unified: 512x320 x 33 frames in ~19 min cold (incl. text-encoder download), t2v with audio. Dims must be multiples of 64. i2v, retake/extend, keyframe interpolation supported.",
|
|
},
|
|
{
|
|
id: "ltx-2.3-mlx-q8",
|
|
tier: "large",
|
|
sizeMB: 87500, // full repo, measured 87.51GB
|
|
needs: { ramMB: 32768, gpu: true },
|
|
wordTimestamps: false,
|
|
install:
|
|
'git clone https://github.com/dgrauet/ltx-2-mlx && cd ltx-2-mlx && uv sync --all-extras && export PATH="$PWD/.venv/bin:$PATH"',
|
|
invoke:
|
|
"ltx-2-mlx generate --prompt {prompt} --two-stage --low-ram --model dgrauet/ltx-2.3-mlx-q8 --width {w} --height {h} --frames {frames} --frame-rate 24 --output {out}",
|
|
notes:
|
|
"LTX 2.3 int8 on MLX, two-stage (upstream production default; higher quality than the q4 distilled tier). Replaced dgrauet/ltx-2.3-mlx-bf16, which is gated (HTTP 401) and cannot be downloaded at all. Costs an 87.5GB download against q4's 59.7GB - a real tradeoff, not a rounding difference. --two-stage is dev model + CFG at half-res, upscale, then distilled LoRA refine (upstream's own help text), so it needs transformer-dev + transformer-distilled + spatial_upscaler_x2; the full snapshot carries all three. --low-ram matches this tier's 32GB floor (block streaming); 64-128GB Macs for long/HD runs. NOT live-verified on a 32GB+ machine - the q4 tier below is the verified one.",
|
|
},
|
|
],
|
|
imagegen: [
|
|
// 2026-07 X research + live verification on a 24GB M-series Mac. mflux
|
|
// (FLUX-on-MLX) is the Mac-native runner; FLUX is the quality leader. Two
|
|
// hard-won findings baked into `needs.ramMB`:
|
|
// 1. The OFFICIAL FLUX repos are HF-gated (license wall). Point --path at a
|
|
// non-gated community 4-bit re-upload (self-contained, incl. VAE).
|
|
// 2. Without --low-ram, FLUX's T5-XXL text encoder + transformer blow past
|
|
// 24GB into swap: a 768x512 run took 90 MINUTES. With --low-ram (streams
|
|
// components from disk) the SAME machine did 512x512 in ~20s at 7.6GB
|
|
// free. So the medium tier's needs.ramMB is the streamed floor, not the
|
|
// resident footprint; the large tiers are the no-streaming thresholds.
|
|
// The runner resolves `repo` to a local snapshot (hf download) before --path;
|
|
// a bare repo id in --path breaks mlx unflatten.
|
|
{
|
|
id: "flux-schnell-mflux-q4",
|
|
tier: "medium",
|
|
sizeMB: 8700,
|
|
needs: { ramMB: 8000, gpu: true },
|
|
repo: "dhairyashil/FLUX.1-schnell-mflux-4bit",
|
|
wordTimestamps: false,
|
|
install: "uv venv ~/.venvs/mflux && VIRTUAL_ENV=~/.venvs/mflux uv pip install mflux==0.9.6",
|
|
invoke:
|
|
"mflux-generate --model schnell --path {model_path} --low-ram --steps 4 --prompt {prompt} --width {w} --height {h} --seed {seed} --output {out}",
|
|
notes:
|
|
"FLUX.1 schnell int4. VERIFIED on 24GB (7.6GB free): --low-ram 512x512 in ~20s, photoreal. --low-ram is MANDATORY at this tier (streams to avoid swap). Few-step, fast.",
|
|
},
|
|
{
|
|
id: "flux2-klein-mflux-q4",
|
|
tier: "large",
|
|
sizeMB: 12000,
|
|
needs: { ramMB: 32000, gpu: true },
|
|
repo: "Runpod/FLUX.2-klein-4B-mflux-4bit",
|
|
wordTimestamps: false,
|
|
install: "uv venv ~/.venvs/mflux && VIRTUAL_ENV=~/.venvs/mflux uv pip install mflux",
|
|
invoke:
|
|
"mflux-generate --base-model flux2-klein-4b --path {model_path} --steps 8 --prompt {prompt} --width {w} --height {h} --seed {seed} --output {out}",
|
|
notes:
|
|
"FLUX.2 Klein 4B int4 (most-downloaded mflux community repo). Newer, higher quality than schnell; full-resident (no streaming) so needs 32GB+ to stay fast. Needs mflux >= 0.18 for the flux2-klein base model.",
|
|
},
|
|
{
|
|
id: "qwen-image-mflux",
|
|
tier: "xlarge",
|
|
sizeMB: 40000,
|
|
needs: { ramMB: 64000, gpu: true },
|
|
repo: "Qwen/Qwen-Image",
|
|
wordTimestamps: false,
|
|
install: "uv venv ~/.venvs/mflux && VIRTUAL_ENV=~/.venvs/mflux uv pip install mflux",
|
|
invoke:
|
|
"mflux-generate --base-model qwen --steps 20 --prompt {prompt} --width {w} --height {h} --seed {seed} --output {out}",
|
|
notes:
|
|
"Qwen-Image, top-tier quality. Heavy: 'several minutes' even on 128GB M4 Max, 'almost fried' a 32GB M4 Pro. 64GB+ only. Below that, the cloud upsell (codex) is faster and better.",
|
|
},
|
|
],
|
|
};
|
|
|
|
function tableFor(capability) {
|
|
const t = MODELS[capability];
|
|
if (!t) throw new Error(`unknown local-model capability: ${capability}`);
|
|
return t;
|
|
}
|
|
|
|
/** All local models for a capability. */
|
|
export function listModels(capability) {
|
|
return tableFor(capability).slice();
|
|
}
|
|
|
|
// Tokenize an `invoke` template on whitespace first, then substitute each
|
|
// token, so a `{prompt}`/`{model_path}` value with spaces stays a single argv
|
|
// entry. Shared by every local-model provider (mflux, LTX) that builds argv
|
|
// from a MODELS[...].invoke template.
|
|
export function buildArgv(template, vars) {
|
|
return template
|
|
.trim()
|
|
.split(/\s+/)
|
|
.map((tok) => tok.replace(/\{(\w+)\}/g, (_, k) => (k in vars ? String(vars[k]) : `{${k}}`)));
|
|
}
|
|
|
|
/** Does this machine meet a model's needs? Apple Silicon unified memory counts as VRAM. */
|
|
export function meetsSpecs(model, specs) {
|
|
const n = model.needs || {};
|
|
// Gate on AVAILABLE RAM when the probe reported it (the real budget with the
|
|
// OS + open apps resident); fall back to total RAM otherwise. Older specs
|
|
// objects (and unit fixtures) that only set ramMB keep working unchanged.
|
|
const budget = specs.availableRamMB ?? specs.ramMB;
|
|
if (n.ramMB && budget < n.ramMB) return false;
|
|
if (n.gpu && !specs.gpu?.present) return false;
|
|
if (n.vramMB) {
|
|
const vram = specs.gpu?.vramMB ?? 0;
|
|
if (vram < n.vramMB) return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// "Best model the machine can run" == best-first among those that fit. Ordering:
|
|
// 1. explicit `rank` (lower = better) when a model declares it. Needed where
|
|
// quality is NOT size: Parakeet-0.6B beats Whisper-large-1.5B at ASR, so
|
|
// footprint would pick the wrong one.
|
|
// 2. otherwise RAM footprint descending, the quality proxy for generation
|
|
// (a 40GB image model out-renders a 12GB one).
|
|
function rankedByPreference(table) {
|
|
return [...table].sort((a, b) => {
|
|
const ra = a.rank ?? Infinity;
|
|
const rb = b.rank ?? Infinity;
|
|
if (ra !== rb) return ra - rb;
|
|
return (b.needs?.ramMB ?? 0) - (a.needs?.ramMB ?? 0);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Every local model for a capability this machine can actually run, best-first
|
|
* (same ordering as selectModel, whose pick is this list's head).
|
|
*
|
|
* Callers that can retry should walk the whole list: a table entry can be
|
|
* unusable for reasons no spec check can see - weights pulled or gated behind a
|
|
* login, the runner missing from PATH, an OOM at a tier that nominally fits. On
|
|
* a single-select call any one of those fails the entire local path, because the
|
|
* cascade cannot tell "this model is broken" from "nothing here fits you".
|
|
* Demoting to the next fitting tier is almost always what the user wanted.
|
|
*/
|
|
export function selectModelLadder(capability, specs, { preferTier } = {}) {
|
|
const table = tableFor(capability);
|
|
const pool = preferTier ? table.filter((m) => m.tier === preferTier) : table;
|
|
return rankedByPreference(pool).filter((model) => meetsSpecs(model, specs));
|
|
}
|
|
|
|
/**
|
|
* Pick the best local model the machine can run for a capability: the
|
|
* highest-footprint model that fits the available-RAM budget (and GPU/VRAM).
|
|
* `preferTier` pins the search to one tier (e.g. force a smaller/faster model).
|
|
* Returns `{ model, tier }`, or `{ recommend: "cli", reason }` when nothing fits.
|
|
*/
|
|
export function selectModel(capability, specs, { preferTier } = {}) {
|
|
const table = tableFor(capability);
|
|
const [model] = selectModelLadder(capability, specs, { preferTier });
|
|
if (model) return { model, tier: model.tier };
|
|
const smallest = table.reduce((a, b) => (a.sizeMB <= b.sizeMB ? a : b));
|
|
return {
|
|
recommend: "cli",
|
|
reason: `machine does not meet specs for any local ${capability} model (smallest needs ~${smallest.needs.ramMB}MB RAM${smallest.needs.gpu ? " + GPU" : ""}); use the CLI path instead`,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Agent-facing ladder: every model for a capability, best-first, each flagged
|
|
* with whether it fits this machine and why. Lets the agent see the RAM-graded
|
|
* options and choose (e.g. trade the auto-picked best for a smaller/faster one,
|
|
* or step up to a cloud upsell) rather than only getting one auto-selection.
|
|
*/
|
|
export function describeModelLadder(capability, specs) {
|
|
const budget = specs.availableRamMB ?? specs.ramMB;
|
|
return rankedByPreference(tableFor(capability)).map((model) => {
|
|
const fits = meetsSpecs(model, specs);
|
|
return {
|
|
id: model.id,
|
|
tier: model.tier,
|
|
needsRamMB: model.needs?.ramMB ?? 0,
|
|
sizeMB: model.sizeMB,
|
|
fits,
|
|
reason: fits
|
|
? `fits (needs ~${model.needs?.ramMB}MB, ${budget}MB available)`
|
|
: `too big (needs ~${model.needs?.ramMB}MB${model.needs?.gpu ? " + GPU" : ""}, ${budget}MB available)`,
|
|
notes: model.notes,
|
|
};
|
|
});
|
|
}
|