Files
llama.cpp/tools/ui/src/lib/constants/model-compatibility.constants.ts
T
Aleksander Grygier 3e43ff1b33 ui : model memory-fit estimation
Replace the raw runtime-memory estimate with the app's compatibility check:
the smallest real Mac memory tier that fits a model file, budgeted as
RAM x 0.75 minus fixed overhead with headroom on the file size. The constants
move to lib; the unused runtime-memory estimate is dropped. browser-info's
OS detection is exported for reuse.

Assisted-by: pi:GLM-5.3-Flash
2026-09-16 13:53:33 +02:00

33 lines
1.1 KiB
TypeScript

/**
* Model memory-fit constants.
*
* Mirrors the app's compatibility check (Model+Compatibility.swift):
* budget = RAM x RAM_BUDGET_RATIO - RAM_OVERHEAD_MB
* weightBytes = fileBytes x QUANT_WEIGHT
* a file fits when weightBytes <= budget. Kept here so the estimation util and
* any caller share one source.
*/
/** Bytes in one mebibyte (MiB), used to convert a file size to MB. */
export const MIB_BYTES = 1_048_576;
/** MB in one GB. */
export const MB_PER_GB = 1024;
/** Overhead multiplier applied to the file size when estimating weight memory. */
export const QUANT_WEIGHT = 1.05;
/** Share of RAM the app allows the model to occupy. */
export const RAM_BUDGET_RATIO = 0.75;
/** Fixed RAM overhead (MB) reserved for the system and KV cache. */
export const RAM_OVERHEAD_MB = 2048;
/**
* Memory tiers (GB) covering the RAM sizes common machines ship with, in
* small enough steps that the requirement reads honestly. Device-agnostic on
* purpose: the server exposes no host RAM, so the UI presents the tier and
* lets the user judge.
*/
export const MEM_TIERS = [4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024];