Merge branch 'f-133-choice' into rel-0.1.33

This commit is contained in:
Niko1221 committed 2026-10-01 21:12:04 +02:00
commit decfc96c98
12 files changed
+1837 -84

No files matched your search

+2 -1
View File
@@ -161,7 +161,8 @@ the same way - nothing big is downloaded again.
or name them with `-e GPUS=0,2` and where the later card's layers start with `-e LAYER_SPLIT=18`.
A memory limit needs `-e LOW_RAM=on`, which maps the model's experts from the pack instead of
keeping them in RAM: setup.py measures the host's RAM, not the container's limit, so it cannot
see a cap. LOW_RAM runs on one card.
see a cap. LOW_RAM runs on one card unless `GPUS` names several (then the experts the cards do not hold are
read through the OS file cache, which can fill the RAM during long prompts).
The server listens on `0.0.0.0:8080` by default; set `-e API_KEY=<secret>` before exposing the port
to a network. The image has a `HEALTHCHECK` on `/health`, so `docker ps` shows the container
healthy once the model is loaded, and `GET /v1/status` says what it is running.
+15 -4
View File
@@ -50,14 +50,17 @@ accepted, so a different answer to the same prompt moves it by several percent.
[`bench/results/2026-09-28-speed-0114`](../bench/results/2026-09-28-speed-0114/README.md).
IQ3_XXS and IQ3_S at 262K are not measured: with their 43 / 50 GB of experts, a 260K-token context brings a 64 GB PC
to its memory limit. Use up to 128K with them on 64 GB (setup caps it). IQ3_S (engine 0.1.4 or newer) is only published
for the original model, not for Swift 1.5.
to its memory limit by setup's estimate (the experts + the context's KV cache + 24 GB), so setup recommends up to 128K
with them on 64 GB. A longer context you choose (`--context 262144`, or a pick in its list) is kept, with a note: users
ran IQ3_S at 256K on 64 GB with RAM to spare (#406). In the low-RAM mode the KV cache stays in VRAM and the context
does not count against RAM. IQ3_S (engine 0.1.4 or newer) is only published for the original model, not for Swift 1.5.
**KV streaming (engine 0.1.5):** at 64K and more, setup keeps the context's KV cache in RAM and only the part the
attention reads in VRAM (`--kv-resident 32768`), so more experts fit on the GPU. Q2_0 at 262K: 50.9 -> 62.6 tokens/s
(1,589 -> 3,872 experts in VRAM); at 128K about +6%. The attention reads exactly the same values (only where the KV lives changes); it
costs ~13.7 KB of RAM per context token (1.7 GB at 128K). Existing installs: run `START-HERE.bat --setup` once to turn
it on.
it on. Setup turns it on when the RAM has room for it; `--kv-streaming on|off` overrides that (on past the RAM test with a
note; never with `--kv k8v4` or under WSL, which cannot stream).
**4-bit KV cache (engine 0.1.8, optional):** `START-HERE.bat --setup` asks above 8K context (or pass `--kv q4_0`). It
halves the KV cache's memory with a Hadamard rotation before 4-bit rounding (PR #21), about 4% faster at 128K, but it
@@ -117,6 +120,12 @@ other ~18 GB), a 32 GB PC with a 12-16 GB GPU the Coder; IQ3_XXS on a 32 GB PC s
not hold do not fit, it says so and runs the plain mapped mode. The server log shows, per request, how many expert
reads went to the file (`resident RAM: ... blob reads from the file`: 0 in steady use).
- `--low-ram resident|mmap` forces one variant (also on a PC with enough RAM, e.g. to try it).
- Several GPUs (#364, #384): setup recommends one GPU in the low-RAM mode (the resident variant has no layer split
yet), and asks; `--gpus 0,1` (or answering 2) shares the model across them with the mapped variant
(`--mmap-experts`): the cards together hold more of the experts, and two users measured it 1.3-1.6x faster than
one card, but the OS file cache can fill the RAM to 0 free during long prompts. `--yes` keeps one GPU. A config
with `--resident-experts` started with `--gpus` switches to `--mmap-experts` with a note, and the engine runs that
pair as `--mmap-experts` with a warning instead of refusing it.
**Low-RAM mode without `experts.bin` (engine 0.1.31):** for the native packs (IQ2_XS, IQ3_XXS, IQ3_S, the Coder, Swift,
Q2_0 packed by `tools/iq_pack.py`; not the canonical Q2_0 pack setup makes for AVX-512 CPUs) the mapped mode no longer
@@ -131,7 +140,9 @@ engine fetches a layer's missing experts on 8 threads (`STRATA_FETCH_THREADS`) w
**A RAM budget (engine 0.1.31, `--resident-budget-gib N`):** the resident variant for a model whose experts do not all
fit: the N GiB of experts the GPU cache does not hold that the expert profile ranks hottest are copied into RAM at
start (locked; page-locked when the driver allows the whole budget), and the rest are read from the files through the
OS file cache. It implies `--mmap-experts` and leaves 4 GB of free RAM (a larger N is clamped, with a message). With
OS file cache. It implies `--mmap-experts` and leaves 4 GB of free RAM (a larger N is clamped to that less 256 MiB,
with a message; #403: a clamped budget no longer fails the safety check that follows, and a budget that cannot be
kept at all is a warning, with every expert read from the files). Setup sets N with `--resident-budget-gib N`. With
the GGUF read in place it also warms the next layer's likely experts: while the CPU works on a layer, a thread applies
the next layer's router to this layer's input and asks the OS for the pages of the predicted experts that neither the
GPU nor the RAM budget holds (only pages - the experts computed are the same; `STRATA_LOOKAHEAD=0` turns it off). This
+2 -1
View File
@@ -43,7 +43,8 @@ now on; the answer is kept.
**Not supported** (setup says so and names the cards that can be used instead):
- a card older than the RTX 20 series (compute capability below 7.5: GTX 10 and older);
- a card with less than 8 GB of VRAM, together with others (each card holds a copy of the dense weights and its
own prompt buffers);
own prompt buffers) - unless you name it with `--gpus`: then setup says the risk and asks (`--yes` with the named
cards goes ahead);
- Intel GPUs, and a mix of NVIDIA and AMD cards. (AMD cards share a model among themselves: `./setup.sh --backend
hip --gpus 1,0`, see [AMD_HIP.md](AMD_HIP.md).)
+5 -3
View File
@@ -22,7 +22,8 @@ START-HERE.bat --setup --family unsloth --model UD-Q4_K_XL
What setup does differently for this model:
- It needs 48 GB of RAM or more and engine 0.1.32 or newer (checked before anything is downloaded), and an NVIDIA
- It needs 48 GB of RAM or more (with less it asks, default no; `--model UD-Q4_K_XL --yes` installs it anyway) and
engine 0.1.32 or newer (checked before anything is downloaded), and an NVIDIA
GPU. One GPU only: with `--gpus` it uses the first one and says so. No images (the vision encoder is not wired to
this file yet) and no experimental speed projection (not tested with it).
- It downloads the four shards below from the pinned revision `38bb39e` (resumable, like the other models), then
@@ -30,7 +31,8 @@ What setup does differently for this model:
in the file's finish mark. A file with the wrong hash is deleted, so the next run downloads it again.
- It packs with `--compat-bf16` and never writes `experts.bin` (`--low-ram` does not apply).
- The RAM budget is the PC's RAM less 24 GB: `--resident-budget-gib 40` on 64 GB, at most all 71 GiB of experts on
96 GB or more. From a 64K context up, where the KV cache moves to RAM, its size comes out of the budget.
96 GB or more. From a 64K context up, where the KV cache moves to RAM, its size comes out of the budget. Setup's
`--resident-budget-gib N` sets another one (a bigger one is kept, with a note on what it risks).
- It recommends an 8K context on a GPU under 14 GB (every GB of KV cache is a GB less of cached experts).
## The files
@@ -130,7 +132,7 @@ budget take first.
**Choosing the RAM budget N:** your RAM minus 20-24 GB (the OS, the engine itself, the 126 MB router copy, and room for
the OS file cache that serves the rest). On 64 GB, 40. The engine clamps a budget larger than the RAM it finds free
(minus 4 GB) and says so. Everything above N comes from the SSD for every token, so N is the setting that matters
(minus 4 GB and a 256 MiB margin) and says so; before #403's fix such a clamped budget could then fail the start. Everything above N comes from the SSD for every token, so N is the setting that matters
most; a bigger budget was faster in every measurement (24 / 32 / 40 GiB). When the driver page-locks the whole budget
(24 GiB did on this PC, 32 and 40 did not), the GPU also computes a share of the misses over PCIe, as in the resident
low-RAM mode; `STRATA_RESIDENT_PIN=0` keeps the budget locked only (the CPU then computes every miss).
+226 -58
View File
@@ -27,7 +27,13 @@ answers, no questions), --setup (install another model / change settings instead
--host 0.0.0.0 --api-key KEY (reach it from other devices on your network), --experimental-speed-projection on|off
(EXPERIMENTAL, off by default),
--models-dir DIR, --gguf-dir DIR (use GGUF files you already have), --build (compile instead of the ready-made
engine), --check (only check this PC).
engine), --check (only check this PC), --resident-budget-gib N (UD-Q4_K_XL's experts in RAM), --kv-streaming
on|off|auto.
Setup recommends, it never forces: the recommended answers are the defaults (--yes, or Enter), and a bigger choice
than it recommends - a longer context, more GPUs, a bigger RAM budget, a size it thinks will not fit - is kept, with
what it risks. With --yes, an explicit flag (--model, --gpus, ...) is the consent to a risk setup would otherwise
stop at; --yes alone is not.
"""
from __future__ import annotations
@@ -451,14 +457,24 @@ def parse_gpus(text, found) -> list:
return sel
def check_gpus(sel, found, what="") -> None:
"""Stops with a plain message when a chosen card is missing or cannot be used, and says what can."""
def check_gpus(sel, found, what="", yes=False, named=False) -> None:
"""Stops with a plain message when a chosen card is missing or cannot be used, and says what can. named: the user
named these cards (--gpus 0,1, or a config that has them): a card that is only short of VRAM for sharing the model
is then a risk to confirm, not a stop (the owner's rule; --yes with the named cards is the consent)."""
together = len(sel) > 1
for i in sel:
g = next((x for x in found if x["index"] == i), None)
p = "not found on this PC" if g is None else gpu_problem(g, together)
if p is None:
continue
if named and g is not None and gpu_problem(g) is None: # it runs Strata; only its VRAM is small
confirm_risk(f"GPU {i} ({g['name']}) has {g['vram_gb']:.0f} GB of VRAM: a card sharing the model needs "
f"{SPLIT_MIN_VRAM_GB} GB or more (it holds the dense weights of its layers and its own prompt "
"buffers), so the model may not start, or run slower than without it", True, yes,
f"GPU {i} ({g['name']}) {what}is not used together with other GPUs: {p}",
"leave it out of --gpus, or answer y to use it anyway", " Use it anyway?")
warn(f"GPU {i} ({g['name']}) is used together with the others, as you chose")
continue
say()
gpu_table(found)
can = together_ok(found)
@@ -514,7 +530,7 @@ def choose_gpus(a, found) -> list:
together recommended), else the supported card with the most VRAM. Returns their numbers, the main one first."""
if a.gpus:
sel = parse_gpus(a.gpus, found)
check_gpus(sel, found)
check_gpus(sel, found, yes=a.yes, named=str(a.gpus).strip().lower() != "all")
return sel
if a.gpu is not None:
check_gpus([a.gpu], found)
@@ -542,6 +558,22 @@ def choose_gpus(a, found) -> list:
return [g["index"] for g in pick]
def split_mmap(cfg: dict) -> bool:
"""#364 #384: the low-RAM mode's resident variant (--resident-experts) has no layer split yet. A config with it
that runs on several GPUs reads the experts the GPUs do not hold through the OS file cache instead
(--mmap-experts: the placement those reports measured 1.3-1.6x faster than one GPU), said plainly - the engine
used to refuse the pair. True when the config changed."""
a = cfg.get("args", [])
if "--resident-experts" not in a:
return False
a[a.index("--resident-experts")] = "--mmap-experts"
warn("the low-RAM mode's resident variant (--resident-experts) has no layer split yet: on several GPUs the experts "
"the GPUs do not hold are read through the OS file cache (--mmap-experts) instead, and RAM can fill up to 0 "
"free during long prompts. One GPU keeps them in RAM (steady RAM use): START-HERE --setup, or --gpu N for a "
"start")
return True
def offer_together(cfg_path: Path, cfg: dict, yes: bool) -> dict:
"""Starting a model set up for one card on a PC with two or more that can share it: asked once (the answer is
saved in its config)."""
@@ -553,17 +585,24 @@ def offer_together(cfg_path: Path, cfg: dict, yes: bool) -> dict:
return cfg
pair = can[:2]
cfg["gpus_asked"] = True
# #364 #384: the resident low-RAM variant stays on one card unless the user says otherwise (its RAM use is steady)
resident = "--resident-experts" in cfg.get("args", [])
say()
say(" This PC has " + " and ".join(gpu_name(g) for g in pair) + ": Strata can share the model across both.")
say(" Together they hold about twice the model's experts and read prompts about 20% faster (docs/MULTI_GPU.md).")
if resident:
say(" This model runs in the low-RAM mode with its experts kept in RAM, on one GPU (recommended: steady RAM")
say(" use). On both, the experts the GPUs do not hold are read through the OS file cache instead: faster in")
say(" two reports (#364, #384), but RAM can fill up to 0 free during long prompts.")
missing = [g for g in pair if not engine_runs_on(g)]
if missing:
say(" The installed engine has no code for " + ", ".join(g["name"] for g in missing) + ": to use them "
"together, run START-HERE.bat --setup --gpus " + ",".join(str(g["index"]) for g in pair))
elif ask(" Use both from now on? (you can change it later: START-HERE.bat --gpu N for one card)",
["y", "n"], "y", yes) == "y":
["y", "n"], "n" if resident else "y", yes) == "y":
cfg["gpu"] = [g["index"] for g in pair]
cfg["layer_split"] = cfg.get("layer_split") or "auto"
split_mmap(cfg)
ok("from now on this model runs on " + " + ".join(gpu_name(g) for g in pair))
else:
ok("staying on one GPU (START-HERE.bat --gpus " + ",".join(str(g["index"]) for g in pair) + " switches)")
@@ -790,6 +829,20 @@ def resident_budget_gib(model, ram, kv_ram_gb=0.0) -> int:
return max(8, min(gib, int(MODELS[model]["arena_gb"] / 1.073741824)))
def budget_choice(model, ram, asked) -> float:
"""S4: UD-Q4_K_XL's RAM budget: --resident-budget-gib N as given, else the recommendation (resident_budget_gib).
More than the recommendation is kept, with what it risks (the owner's rule: setup recommends, it never forces)."""
rec = resident_budget_gib(model, ram)
if asked is None:
return rec
if asked > rec:
warn(f"a {asked:g} GiB RAM budget is more than setup recommends for this PC ({rec} GiB: the RAM less "
f"{UNSLOTH_RAM_LEFT_GB} GB for the OS, the engine and the file cache that reads the other experts). Kept "
"as you chose: the engine clamps it to the RAM it finds free at start (less 4 GB), and the file cache "
"gets less room - it may be slower, or run the PC out of RAM under load")
return int(asked) if asked == int(asked) else asked
def check_shards(shards):
"""Every shard present and whole, or setup stops naming the file and the numbers. Whole means as long as
its own tensor directory says (the header is read, the data is not): a truncated copy (--gguf-dir, a .part
@@ -1539,8 +1592,9 @@ def low_ram_fits(model, ram, vram_gb) -> bool:
return ram - 6 + max(0.0, vram_gb - 5) >= arena
def low_ram_one_gpu_why(model, ram, choice) -> list[str]:
"""#250: why the low-RAM mode leaves the other GPUs out, with the RAM math that turned it on."""
def low_ram_one_gpu_why(model, ram, choice, sel=None) -> list[str]:
"""#250: why the low-RAM mode recommends one GPU, with the RAM math that turned it on; #364 #384: and how to use
all of them (sel: the cards, for the --gpus example)."""
arena, need = MODELS[model]["arena_gb"], MODELS[model]["arena_gb"] + LOW_RAM_HEADROOM_GB
if choice == "auto":
why = [f"Why: {model}'s experts are {arena:.0f} GB and must fit in RAM with ~{LOW_RAM_HEADROOM_GB} GB beside "
@@ -1551,26 +1605,93 @@ def low_ram_one_gpu_why(model, ram, choice) -> list[str]:
else:
why = [f"Why: you chose the low-RAM mode (--low-ram {choice}); without it {model} needs {arena:.0f} + "
f"{LOW_RAM_HEADROOM_GB} = {need:.0f} GB of RAM, this PC has {ram:.0f} GB."]
return why + ["That mode runs on one GPU: the engine does not split its layers across GPUs in it (it refuses "
"--resident-experts with a layer split).",
f"To use all the GPUs: {need:.0f} GB of RAM or more, a smaller size, or --low-ram off (the experts "
"then stay in RAM and the OS pages part of them to disk: much slower)."]
return why + ["Its resident variant (the experts the GPU does not hold copied into RAM once: steady RAM use) runs "
"on one GPU: the engine has no layer split for it yet.",
f"To use all the GPUs: --gpus {','.join(str(i) for i in sel) if sel else '0,1'} - the experts the "
"GPUs do not hold are then read through the OS file cache: faster in two reports (1.3-1.6x, #364 "
f"#384), but RAM can fill up to 0 free during long prompts. Or {need:.0f} GB of RAM or more, or a "
"smaller size."]
def confirm_paging(model, ram, choice, yes):
def low_ram_together(a, model, ram, gpu, chosen) -> bool:
"""#364 #384: the low-RAM mode with several GPUs chosen. One GPU is recommended: the resident variant keeps the
experts the GPU does not hold in RAM (steady RAM use) and has no layer split. All the GPUs together read those
experts through the OS file cache instead (--mmap-experts) - 1.3-1.6x faster in those reports, but RAM can fill
up to 0 free during long prompts. An explicit --gpus (or an earlier install's cards) is kept; otherwise asked,
one GPU by default (--yes: one GPU, as before). True: all of them."""
sel = [g["index"] for g in chosen]
names = " + ".join(gpu_name(g) for g in chosen)
if a.gpus:
warn(f"the low-RAM mode on {names}, as you chose (--gpus): the experts the GPUs do not hold are read through "
"the OS file cache (the resident variant has no layer split yet), and RAM can fill up to 0 free during "
"long prompts")
say(f" One GPU keeps them in RAM (steady RAM use, recommended): --gpu {gpu['index']}")
if a.low_ram == "resident":
warn("--low-ram resident has no layer split yet: the experts are read through the OS file cache instead")
return True
if a.low_ram != "resident" and not a.yes:
say()
for line in low_ram_one_gpu_why(model, ram, a.low_ram, sel):
say(" " + line)
say(f" 1) {gpu_name(gpu)} only: the experts it does not hold kept in RAM where they fit (recommended: "
"steady RAM use)")
say(f" 2) {names} together: the experts the GPUs do not hold read through the OS file cache - faster")
say(" in two reports (1.3-1.6x, #364 #384), but RAM can fill up to 0 free during long prompts")
if ask("Low-RAM mode: which GPUs?", ["1", "2"], "1", a.yes) == "2":
ok(f"the low-RAM mode on {names}: the experts read through the OS file cache, as you chose")
return True
warn("the low-RAM mode: using " + gpu_name(gpu) + " only")
return False
warn("the low-RAM mode: using " + gpu_name(gpu) + " only (recommended)")
for line in low_ram_one_gpu_why(model, ram, a.low_ram, sel):
say(" " + line)
return False
def confirm_risk(msg, explicit, yes, stop, hint=None, question=" Go on anyway?", default="n") -> None:
"""The owner's rule: setup recommends, it never forces. A choice setup expects to fail or run badly is said
plainly (msg), then asked (default n; `default` keeps an older question's own default), or with --yes taken as
consent when it was asked for explicitly (a flag such as --model or --gpus): --yes alone keeps the stop
(stop, hint). Returns when it goes on; the caller says what it does."""
warn(msg)
if yes and explicit:
return
if ask(question, ["y", "n"], default, yes) != "y":
fail(stop, hint)
def confirm_paging(model, ram, choice, yes, explicit_model=False):
"""The model's experts do not fit this PC's RAM and the low-RAM mode is off. #125: a warning and a question, not
a stop - the user may accept paging. Asked "no" by default, so an unattended --yes install stops here, unless
the low-RAM mode was turned off explicitly (--low-ram off, #250): that is the choice already made."""
the low-RAM mode was turned off explicitly (--low-ram off, #250) or the size was (--model): that is the choice
already made."""
need_gb, arena = MODELS[model]["ram_gb"], MODELS[model]["arena_gb"]
warn(f"{model} needs about {need_gb} GB of RAM and this PC has {ram:.0f} GB: its experts alone are "
f"{arena:.0f} GB and must stay in RAM, so Windows/Linux will page part of them from disk. Expect it "
"to be much slower, and it may not start at all.")
say(" A smaller size (Q2_0 or IQ2_XS) fits; more RAM fixes it.")
explicit = choice == "off"
if ask(" Install it anyway?", ["y", "n"], "y" if explicit else "n", yes) != "y":
fail(f"{model} needs about {need_gb} GB of RAM; this PC has {ram:.0f} GB",
"choose Q2_0 or IQ2_XS, or add RAM" + ("" if explicit else "; or --low-ram off --yes to install it anyway"))
warn(f"installing {model} with {ram:.0f} GB of RAM, as you chose" + (" (--low-ram off)" if explicit else ""))
off = choice == "off"
confirm_risk(f"{model} needs about {need_gb} GB of RAM and this PC has {ram:.0f} GB: its experts alone are "
f"{arena:.0f} GB and must stay in RAM, so Windows/Linux will page part of them from disk. Expect it "
"to be much slower, and it may not start at all.\n A smaller size (Q2_0 or IQ2_XS) fits; more "
"RAM fixes it.", off or explicit_model, yes,
f"{model} needs about {need_gb} GB of RAM; this PC has {ram:.0f} GB",
"choose Q2_0 or IQ2_XS, or add RAM" + ("" if off else f"; or --model {model} --yes (or --low-ram off "
"--yes) to install it anyway"),
" Install it anyway?", "y" if off else "n")
warn(f"installing {model} with {ram:.0f} GB of RAM, as you chose" + (" (--low-ram off)" if off else
" (--model)" if explicit_model else ""))
def ctx_ram_need(model, ctx, low_ram=False):
"""#406: the RAM (GB) setup estimates for a long context with IQ3_XXS / IQ3_S: their experts + the context's
8-bit KV cache + 24 GB of room for everything else (the 0.1.29 arithmetic, counted). None where the context does
not count against RAM by this rule: the other sizes, and the low-RAM mode (its KV cache stays in VRAM)."""
if model not in ("IQ3_XXS", "IQ3_S") or low_ram:
return None
return MODELS[model]["arena_gb"] + ctx * 13 * 1056 / 1e9 + 24
def ram_ctx(model, ram, low_ram=False) -> int:
"""#406: the longest context the RAM rule recommends: 128K, or longer where the estimate fits this PC's RAM. It
is part of the recommended default (the smaller of it and the GPU's rule); a longer choice is kept, with a note."""
return max(c for c in CONTEXTS if c <= 131072 or (ctx_ram_need(model, c, low_ram) or 0) <= ram)
def settings_path() -> Path:
@@ -1929,7 +2050,7 @@ def start(cfg_path: Path, port: int | None, gpu: int | list | None = None, open_
if cfg.get("backend") == "hip":
pass
elif isinstance(gpu, list): # --gpus: saved, this model runs on these cards from now on
check_gpus(gpu, found)
check_gpus(gpu, found, yes=yes, named=True)
cfg["gpu"], cfg["gpus_asked"] = gpu, True
cfg["layer_split"] = layer_split or cfg.get("layer_split") or "auto"
cfg_path.write_text(json.dumps(cfg, indent=1), encoding="utf-8")
@@ -1940,10 +2061,12 @@ def start(cfg_path: Path, port: int | None, gpu: int | list | None = None, open_
else:
cfg = offer_together(cfg_path, cfg, yes)
use = gpu if gpu is not None else cfg.get("gpu")
if isinstance(use, list) and split_mmap(cfg): # #364 #384: a resident low-RAM config on several GPUs
cfg_path.write_text(json.dumps(cfg, indent=1), encoding="utf-8")
if cfg.get("backend") == "hip":
pass
elif isinstance(use, list):
check_gpus(use, found, "(chosen for this model) ")
check_gpus(use, found, "(chosen for this model) ", yes=True, named=True)
byid = {g["index"]: g for g in found}
cfg = ensure_engine_for([byid[i] for i in use], cfg_path, cfg, yes)
ok("GPUs: " + " + ".join(gpu_name(byid[i]) for i in use) + f" together (layers split {cfg.get('layer_split') or 'auto'})")
@@ -2155,12 +2278,20 @@ def main() -> int:
"(for a PC with a big GPU and little RAM); auto: when the experts would not fit the RAM. In "
"this mode the experts the GPU does not hold are copied into RAM once when they fit (resident), "
"else read through the OS file cache (mmap); resident / mmap force one of the two")
ap.add_argument("--resident-budget-gib", type=float, metavar="N",
help="UD-Q4_K_XL: the GiB of its experts kept in RAM (default: the RAM less 24 GB, 40 on 64 GB; "
"more is kept as you choose, with a note)")
ap.add_argument("--kv-streaming", choices=["auto", "on", "off"], default="auto",
help="from a 64K context: keep the KV cache in RAM and only the attention's window in VRAM (more "
"experts fit on the GPU); auto: when the RAM has room for it")
ap.add_argument("--backend", choices=["cuda", "hip"],
help="cuda = NVIDIA (default), hip = AMD RX 7900 / 7800 / 7700 XT, RX 9060 XT / 9070 / AI PRO R9700 on "
"Linux (experimental; chosen by itself when the PC has no NVIDIA card Strata can use)")
ap.add_argument("--skip-build", action="store_true", help=argparse.SUPPRESS)
a = ap.parse_args()
if a.gpu is not None: # --gpu 0,2 means --gpus 0,2 (a user tried it: issue report)
if a.resident_budget_gib is not None and not a.resident_budget_gib > 0:
ap.error("--resident-budget-gib takes a number of GiB above 0, e.g. --resident-budget-gib 32")
if a.gpu is not None: # --gpu 0,2 means --gpus 0,2 (a user tried it: issue report)
if "," in a.gpu:
a.gpus, a.gpu = a.gpus or a.gpu, None
elif a.gpu.strip().isdigit():
@@ -2303,10 +2434,16 @@ def main() -> int:
low_ok = low_ram_fits("IQ1_M", ram, gpu["vram_gb"]) and a.low_ram != "off" # the smallest model, mapped
if ram < need - 4 and not a.check and not low_ok:
# every model keeps ALL its experts in RAM (23+ GB); VRAM only holds a copy of the most-used ones, so a
# bigger GPU does not lower this
fail(f"RAM: {ram:.0f} GB - the smallest model (the Coder) needs about {need} GB",
"Strata keeps all of the model's experts in RAM (23-50 GB, whatever the GPU) and the GPU holds a copy "
"of the most-used ones: it needs 32 GB of RAM or more (48 GB for the full model)")
# bigger GPU does not lower this. The owner's rule: a stop by default, a risk the user can take (--model
# with --yes, or y)
confirm_risk(f"RAM: {ram:.0f} GB - the smallest model (the Coder) needs about {need} GB: Strata keeps all of "
"the model's experts in RAM (23-50 GB, whatever the GPU), so the OS will page them from disk. "
"Expect it to be very slow, and it may not start at all.", bool(a.model), a.yes,
f"RAM: {ram:.0f} GB - the smallest model (the Coder) needs about {need} GB",
"Strata keeps all of the model's experts in RAM (23-50 GB, whatever the GPU) and the GPU holds a "
"copy of the most-used ones: it needs 32 GB of RAM or more (48 GB for the full model); --model "
"NAME --yes installs one anyway")
warn(f"going on with {ram:.0f} GB of RAM, as you chose")
ok(f"RAM: {ram:.0f} GB" if ram >= need - 4 else f"RAM: {ram:.0f} GB (less than the {need} GB the smallest model needs)"
+ ("; the GPU's VRAM makes up for it (the low-RAM mode)" if ram < need - 4 and low_ok else ""))
pf = page_file_gb()
@@ -2370,31 +2507,37 @@ def main() -> int:
warn(f"{model} is EXPERIMENTAL (docs/UNSLOTH_Q4.md): most of its experts are read from the SSD while it "
"answers, so it is several times slower than the 2-3-bit models; quality checked against llama.cpp")
if ram < MODELS[model]["ram_gb"]:
fail(f"{model} needs {MODELS[model]['ram_gb']} GB of RAM or more; this PC has {ram:.0f} GB",
"choose one of the 2-3-bit models")
budget = resident_budget_gib(model, ram)
ok(f"RAM budget: {budget} GiB of {model}'s experts in RAM, the rest read from the model files on the SSD")
confirm_risk(f"{model} needs {MODELS[model]['ram_gb']} GB of RAM or more; this PC has {ram:.0f} GB: "
f"its RAM budget would be {resident_budget_gib(model, ram)} GiB, so nearly every expert is "
"read from the SSD while it answers (very slow), and it may run out of RAM",
bool(a.model), a.yes, f"{model} needs {MODELS[model]['ram_gb']} GB of RAM or more; this PC "
f"has {ram:.0f} GB", f"choose one of the 2-3-bit models, or --model {model} --yes to "
"install it anyway", " Install it anyway?")
warn(f"installing {model} with {ram:.0f} GB of RAM, as you chose")
budget = budget_choice(model, ram, a.resident_budget_gib)
ok(f"RAM budget: {budget:g} GiB of {model}'s experts in RAM, the rest read from the model files on the SSD")
if a.low_ram not in ("auto", "off"):
warn(f"--low-ram {a.low_ram} does not apply to {model}: it always reads part of its experts from the files")
if multi:
warn(f"{model} runs on one GPU: using " + gpu_name(gpu) + " only")
multi, sel, chosen = [], [gpu["index"]], [gpu]
elif a.resident_budget_gib is not None:
warn(f"--resident-budget-gib is for UD-Q4_K_XL: {model} keeps all of its experts in RAM or in the low-RAM mode")
low_ram = budget is None and (a.low_ram in ("on", "resident", "mmap") or
(a.low_ram == "auto" and low_ram_needed(model, ram)))
if low_ram and multi:
warn("the low-RAM mode runs on one GPU: using " + gpu_name(gpu) + " only")
for line in low_ram_one_gpu_why(model, ram, a.low_ram):
say(" " + line)
if low_ram and multi and not low_ram_together(a, model, ram, gpu, chosen):
multi, sel, chosen = [], [gpu["index"]], [gpu]
# (the low-RAM mode's variant is decided once the context is known, below)
# (the low-RAM mode's variant is decided once the context is known, below; on several GPUs it is the mapped one)
if not low_ram and budget is None and ram < MODELS[model]["ram_gb"] - 4:
confirm_paging(model, ram, a.low_ram, a.yes)
confirm_paging(model, ram, a.low_ram, a.yes, bool(a.model))
ok(f"size: {model}")
tag = fam["tag"] + model # names of the pack, config and start script
small = min(x["vram_gb"] for x in chosen) # each card keeps its layers' KV of the whole context
rec_ctx = 32768 if small < 14 else 65536 if small < 20 else 131072
if budget is not None: # UD-Q4_K_XL: every GB of KV is a GB fewer of cached experts
rec_ctx = 8192 if small < 14 else 32768
# #406: the RAM rule is part of the recommendation (the smaller of the two), no longer a cap over the user's choice
rec_ctx = min(rec_ctx, ram_ctx(model, ram, low_ram))
if a.context:
ctx = a.context
else:
@@ -2402,20 +2545,22 @@ def main() -> int:
say(" Context length = how much text the model can see at once (your chat, files, tool output).")
say(" Longer needs more VRAM for it, so fewer experts fit on the GPU:")
for i, c in enumerate(CONTEXTS, 1):
need_c = ctx_ram_need(model, c, low_ram)
note = (" (recommended for your GPU)" if c == rec_ctx else "") + \
(" (experimental: setup adds rope scaling)" if c > 262144 else "")
(" (experimental: setup adds rope scaling)" if c > 262144 else "") + \
(f" (needs ~{need_c:.0f} GB RAM, this PC has {ram:.0f}: may run out of memory)"
if c > 131072 and need_c is not None and need_c > ram else "")
say(f" {i}) {c // 1024}K tokens{note}")
ctx = CONTEXTS[int(ask("Context?", [str(i) for i in range(1, len(CONTEXTS) + 1)],
str(CONTEXTS.index(rec_ctx) + 1), a.yes)) - 1]
# the RAM limit comes FIRST: the rope config must cover the context the engine will actually serve -
# a reduced 384K can land back inside the trained 262144, and then nothing needs scaling (§4). Counted,
# not a fixed 90 GB (the 0.1.29 arithmetic): arena + the context's KV + 24 GB of room for everything else.
asked_ctx = ctx
need_gb = MODELS[model].get("arena_gb", 0) + ctx * 13 * 1056 / 1e9 + 24
if model in ("IQ3_XXS", "IQ3_S") and ram < need_gb and ctx > 131072:
warn(f"{model} with a {ctx // 1024}K context needs about {need_gb:.0f} GB of RAM "
f"({MODELS[model]['arena_gb']:.0f} GB of experts + the context + room for the rest): using 128K")
ctx = 131072
# #406 #364: a context past the RAM rule (an explicit --context, a pick in the list, or the earlier install's) is
# kept, with what it risks. It used to become 128K: users ran 256K fine where setup's estimate said no.
need_gb = ctx_ram_need(model, ctx, low_ram)
if need_gb is not None and ram < need_gb and ctx > 131072:
warn(f"{ctx // 1024}K with {model} needs ~{need_gb:.0f} GB of RAM by setup's estimate "
f"({MODELS[model]['arena_gb']:.0f} GB of experts + the context + room for the rest); this PC has "
f"{ram:.0f}. Kept as you chose: it may be slower or run out of RAM under load. {rec_ctx // 1024}K is the "
"recommended size.")
scaling = a.rope_scaling
if ctx > 262144 and scaling is None and not a.yes:
# the interactive path: one question, yarn preselected (llama.cpp's extension method, recall-tested
@@ -2434,11 +2579,6 @@ def main() -> int:
origin = ("final context / trained 262144; override with --rope-scale" if a.rope_scale is None
else "as requested")
ok(f"rope scaling: {scaling}, factor {rope_scale:g} ({origin})")
elif asked_ctx > 262144:
ok(f"the RAM limit brings the context to {ctx // 1024}K, inside the trained 262,144: no rope scaling")
if scaling is not None and asked_ctx > 262144 and ctx <= 262144:
warn(f"the RAM limit reduced the context to {ctx // 1024}K, inside the trained 262,144; keeping your "
f"explicit rope scaling ({scaling}) anyway - drop --rope-scaling for the completely stock model")
ok(f"context: {ctx} tokens")
# the KV cache (the model's memory of the conversation): 8-bit, or 4-bit after a Hadamard rotation (PR #21)
kv = "fp16" if ctx <= 8192 else (a.kv or "int8")
@@ -2477,7 +2617,17 @@ def main() -> int:
share = low_ram_gpu_share(model, vram, ctx, kv)
rest = arena - low_ram_gpu_gb(model, vram, ctx, kv)
resident = a.low_ram == "resident" or (a.low_ram != "mmap" and low_ram_resident(model, ram, vram, ctx, kv))
if resident:
if multi: # #364 #384: every chosen card's share (the image encoder on the main one), the mapped variant
held = min(arena, low_ram_gpu_gb(model, vram, ctx, kv) +
sum(low_ram_gpu_gb(model, x["vram_gb"], ctx, kv) for x in chosen[1:]))
share, resident = held / arena, False
ok(f"low-RAM mode on {len(chosen)} GPUs: {model}'s experts ({arena:.0f} GB) are read from the model folder "
f"through the OS file cache instead of a copy in RAM ({ram:.0f} GB); the GPUs hold ~{100 * share:.0f}% "
"of them")
if share < 0.6:
warn("most of the experts are read from the SSD while it answers: expect it to be much slower than "
"with enough RAM (a faster SSD and a smaller size help)")
elif resident:
ok(f"low-RAM mode: the GPU holds ~{100 * share:.0f}% of {model}'s experts ({arena:.0f} GB) and the other "
f"~{rest:.0f} GB stay in RAM ({ram:.0f} GB), read once from a copy in the model folder")
else:
@@ -2658,19 +2808,37 @@ def main() -> int:
# Hybrid K8V4 never streams its KV (mode 0 only, layer.hpp), so it is excluded from the WHOLE streaming
# decision rather than one threshold at a time - a future tier added to this chain cannot reintroduce the
# combination the engine refuses (PR review).
# --kv-streaming on|off overrides the RAM test (the owner's rule); k8v4 and WSL stay off - they cannot stream.
stream_fits = ram >= MODELS[model]["ram_gb"] + kv_ram_gb + 1
if kv == "k8v4":
if ctx >= 65536:
ok("KV streaming off: not supported with --kv k8v4; the KV cache stays in VRAM")
if a.kv_streaming == "on":
warn("--kv-streaming on: the engine has no KV streaming with --kv k8v4 (it refuses the pair): off")
elif is_wsl() and ctx >= 65536:
ok("WSL: KV streaming off (the driver pins only about 1 GB of RAM); the KV cache stays in VRAM")
elif ctx >= 65536 and ram >= MODELS[model]["ram_gb"] + kv_ram_gb + 1:
if a.kv_streaming == "on":
warn("--kv-streaming on: WSL cannot stream the KV cache (its RAM copy must be pinned, and the driver pins "
"only about 1 GB there): off")
elif ctx >= 65536 and a.kv_streaming == "off":
ok("KV streaming off, as you chose (--kv-streaming off): the KV cache stays in VRAM")
elif ctx >= 65536 and (stream_fits or a.kv_streaming == "on"):
args += ["--kv-resident", "32768"]
ok(f"KV streaming on: the context's KV cache lives in RAM ({kv_ram_gb:.1f} GB), more experts fit in VRAM")
if budget is not None: # its RAM comes out of the experts' budget
if not stream_fits:
warn(f"KV streaming needs ~{kv_ram_gb:.1f} GB of RAM beside the ~{MODELS[model]['ram_gb']} GB {model} "
f"uses; this PC has {ram:.0f}. Kept as you chose (--kv-streaming on): it may page or run out of RAM "
"under load")
if budget is not None and a.resident_budget_gib is None: # its RAM comes out of the experts' budget
budget = resident_budget_gib(model, ram, kv_ram_gb)
ok(f"RAM budget: {budget} GiB (less the KV cache's RAM)")
elif budget is not None and budget > resident_budget_gib(model, ram, kv_ram_gb):
warn(f"the KV cache's {kv_ram_gb:.1f} GB of RAM come on top of your {budget:g} GiB RAM budget (setup "
f"would take them out of it: {resident_budget_gib(model, ram, kv_ram_gb)} GiB); kept as you chose")
elif a.kv_streaming == "on":
warn("--kv-streaming on: a context under 64K is not streamed (the attention's window holds all of it): off")
if budget is not None: # UD-Q4_K_XL: the experts read from the GGUF in place, the most-used N GiB kept in RAM
args += ["--resident-budget-gib", str(budget)]
args += ["--resident-budget-gib", f"{budget:g}"]
if vision != "none":
args += ["--vision", "--vram-reserve-mib", str(VISION[vision]["reserve_mib"])]
if esp is not None:
+14 -5
View File
@@ -1024,6 +1024,7 @@ bool FileExpertSource::pin_cache_complement(
uint64_t bytes = 0;
if (!detail::make_cache_complement_plan(n_layers_, n_expert_, layer_blob_bytes_, primary_gpu_pairs,
additional_gpu_pairs, offsets, bytes, err)) return false;
uint64_t budget_physical = 0; // #403: the RAM reading a budget was sized from (0: no budget)
if (budget_bytes > 0) {
// CS-T: a RAM budget. The complement's experts in `rank` order (the expert profile, hottest first) while
// they fit, the rest left on the mapped files; clamped to what the RAM has room for.
@@ -1032,13 +1033,19 @@ bool FileExpertSource::pin_cache_complement(
err = "FileExpertSource: cannot determine available RAM for --resident-budget-gib";
return false;
}
budget_physical = physical;
const uint64_t room = physical > headroom_bytes ? physical - headroom_bytes : 0;
if (budget_bytes > room) {
// #403: 256 MiB under the room, so the engine's own allocations after this reading still leave the
// headroom (a budget clamped to exactly the room failed the safety check below on a reading a few MB
// lower). An unclamped budget is unchanged.
const uint64_t margin = 256ull << 20;
const uint64_t clamped = room > margin ? room - margin : 0;
std::fprintf(stderr, "FileExpertSource: --resident-budget-gib %.2f is more than the RAM has room for "
"(%.2f GiB available minus %.0f GiB headroom): %.2f GiB\n",
"(%.2f GiB available minus %.0f GiB headroom and a 0.25 GiB margin): %.2f GiB\n",
(double) budget_bytes / 1073741824.0, (double) physical / 1073741824.0,
(double) headroom_bytes / 1073741824.0, (double) room / 1073741824.0);
budget_bytes = room;
(double) headroom_bytes / 1073741824.0, (double) clamped / 1073741824.0);
budget_bytes = clamped;
}
std::vector<uint64_t> ranked(offsets.size(), kNoComplement);
uint64_t at = 0;
@@ -1065,8 +1072,10 @@ bool FileExpertSource::pin_cache_complement(
const bool lend = lend_from_slot >= 0 && lend_from_slot < n_slots && additional_gpu_pairs.empty();
uint64_t budget = std::numeric_limits<uint64_t>::max();
if (bytes > 0 || lend) {
uint64_t physical = 0;
if (!available_memory_bytes(physical)) {
// #403: with a budget, the reading it was sized from - a second reading a few MB lower (the engine's own
// allocations, the file cache) failed a budget the first one had clamped. (A budget turns `lend` off.)
uint64_t physical = budget_physical;
if (physical == 0 && !available_memory_bytes(physical)) {
err = "FileExpertSource: cannot determine available RAM for the resident-memory safety check";
return false;
}
+27 -7
View File
@@ -272,6 +272,7 @@ struct Options {
bool resident_pin = false;
uint64_t resident_headroom = 8ull << 30;
bool resident_soft = false;
bool resident_cpu_explicit = false; ///< #384: --resident-cpu-experts given by itself (not only implied)
/// CS-T `--resident-budget-gib N`: the resident mode with a RAM budget - the N GiB of experts the GPU cache does
/// not hold that the expert profile ranks hottest are copied into RAM, the rest are read from the files in place
/// (the GGUF shards when the pack has no experts.bin). 0 = the whole complement (--resident-experts).
@@ -1212,7 +1213,7 @@ int main(int argc, char** argv) {
else if (a == "--gpu-stages") o.gpu_stages = true;
else if (a == "--mmap-experts") o.mmap_experts = true;
else if (a == "--shared-expert-arena") o.shared_expert_arena = next("--shared-expert-arena");
else if (a == "--resident-cpu-experts") o.resident_cpu_experts = true;
else if (a == "--resident-cpu-experts") o.resident_cpu_experts = o.resident_cpu_explicit = true;
else if (a == "--resident-experts") {
o.mmap_experts = o.resident_cpu_experts = o.resident_pin = o.resident_soft = true;
o.resident_headroom = 4ull << 30;
@@ -1320,9 +1321,20 @@ int main(int argc, char** argv) {
std::fprintf(stderr, "strata generate: --resident-cpu-experts requires --mmap-experts and a static --expert-profile\n");
return 2;
}
if (o.resident_cpu_experts &&
(!o.layer_split.empty() || o.expert_cache_remote[0] > 0 || o.expert_cache_remote[1] > 0 ||
o.expert_cache_remote[2] > 0)) {
const bool remote_caches = o.expert_cache_remote[0] > 0 || o.expert_cache_remote[1] > 0 ||
o.expert_cache_remote[2] > 0;
if (o.resident_cpu_experts && !o.layer_split.empty() && !remote_caches && o.resident_soft &&
!o.resident_cpu_explicit && o.resident_budget == 0) {
// #364 #384: setup's --resident-experts with a layer split (--gpus at start, or a config edited by hand) runs
// as the plain mmap mode - the placement those users measured 1.3-1.6x faster than one GPU - instead of
// refusing. Exactly --mmap-experts: nothing else reads these flags (the headroom only sizes the copy).
std::fprintf(stderr, "strata generate: WARNING: the resident RAM mode (--resident-experts) does not support a "
"layer split yet: the experts the GPUs do not hold are read through the OS file cache "
"(--mmap-experts), and RAM may fill up during long prompts\n");
o.resident_cpu_experts = o.resident_pin = o.resident_soft = false;
o.resident_headroom = 8ull << 30;
}
if (o.resident_cpu_experts && (!o.layer_split.empty() || remote_caches)) {
std::fprintf(stderr, "strata generate: --resident-cpu-experts does not support layer splits or remote expert caches\n");
return 2;
}
@@ -2682,9 +2694,11 @@ int main(int argc, char** argv) {
const int64_t reserve = ((int64_t) o.vram_reserve_mib + prefill_mib) << 20;
const int64_t fit = std::max<int64_t>(((int64_t) free_b - reserve) / (int64_t) strata::kernels::cpu::expert_layout().max_blob, 0);
if (o.expert_cache > fit) {
std::fprintf(stderr, "strata generate: layer split: --expert-cache %d leaves no room for the prompt path's "
"buffers (%lld MiB) on CUDA0: %lld slots\n", o.expert_cache, (long long) prefill_mib,
(long long) fit);
// a WARNING that names the knob: the user asked for this size, and gets fewer slots
std::fprintf(stderr, "strata generate: WARNING: layer split: --expert-cache %d leaves no room for the "
"prompt path's buffers (%lld MiB) and the %d MiB reserve on CUDA0: %lld slots instead "
"(a smaller --vram-reserve-mib leaves more of them)\n", o.expert_cache,
(long long) prefill_mib, o.vram_reserve_mib, (long long) fit);
o.expert_cache = (int) fit;
}
}
@@ -3784,6 +3798,12 @@ int main(int argc, char** argv) {
std::fprintf(stderr, "strata generate: WARNING: the resident RAM mode does not fit (%s); the experts the "
"GPU does not hold are read from the model folder through the OS file cache "
"(--mmap-experts), which is slower when the RAM cannot keep them\n", err.c_str());
} else if (o.resident_budget > 0) {
// #403: a RAM budget that cannot be kept is not a reason to stop - the experts it would have held are
// read from the files like the ones outside it (pin_cache_complement leaves nothing half-built)
std::fprintf(stderr, "strata generate: WARNING: the RAM budget (--resident-budget-gib) cannot be kept (%s); "
"every expert the GPU does not hold is read from the model files through the OS file "
"cache (--mmap-experts), which is slower\n", err.c_str());
} else {
std::fprintf(stderr, "strata generate: CPU expert residency: %s\n", err.c_str());
return 1;
+966
View File
@@ -0,0 +1,966 @@
{
"128GB-1x24GB qwen IQ3_S": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/iq3_s",
"--native",
"<T>/models/IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"131072",
"--kv",
"int8",
"--kv-resident",
"32768"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-iq3_s.log",
"model_name": "qwen3.8-flash-next-iq3_s",
"port": 8080,
"tokenizer": "<T>/data/packs/iq3_s/tokenizer"
}
},
"128GB-1x24GB qwen IQ3_XXS": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/iq3_xxs",
"--native",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"131072",
"--kv",
"int8",
"--kv-resident",
"32768"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-iq3_xxs.log",
"model_name": "qwen3.8-flash-next-iq3_xxs",
"port": 8080,
"tokenizer": "<T>/data/packs/iq3_xxs/tokenizer"
}
},
"128GB-1x24GB qwen Q2_0": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/q2_0",
"--native",
"<T>/models/Q2_0/Qwen3.8-Flash-Next-GSQ-RCO-Q2_0-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/Q2_0/Qwen3.8-Flash-Next-GSQ-RCO-Q2_0-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"131072",
"--kv",
"int8",
"--kv-resident",
"32768"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-q2_0.log",
"model_name": "qwen3.8-flash-next-q2_0",
"port": 8080,
"tokenizer": "<T>/data/packs/q2_0/tokenizer"
}
},
"128GB-1x24GB qwen recommended": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/iq3_xxs",
"--native",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"131072",
"--kv",
"int8",
"--kv-resident",
"32768"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-iq3_xxs.log",
"model_name": "qwen3.8-flash-next-iq3_xxs",
"port": 8080,
"tokenizer": "<T>/data/packs/iq3_xxs/tokenizer"
}
},
"128GB-1x24GB unsloth UD-Q4_K_XL": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/unsloth-ud-q4_k_xl",
"--native",
"<T>/models/unsloth-UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"32768",
"--kv",
"int8",
"--resident-budget-gib",
"71"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-unsloth-ud-q4_k_xl.log",
"model_name": "qwen3.8-flash-next-unsloth-ud-q4_k_xl",
"port": 8080,
"tokenizer": "<T>/data/packs/unsloth-ud-q4_k_xl/tokenizer"
}
},
"32GB-2x24GB qwen IQ3_S": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/iq3_s",
"--native",
"<T>/models/IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"131072",
"--kv",
"int8",
"--mmap-experts"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-iq3_s.log",
"model_name": "qwen3.8-flash-next-iq3_s",
"port": 8080,
"tokenizer": "<T>/data/packs/iq3_s/tokenizer"
}
},
"32GB-2x24GB qwen IQ3_XXS": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/iq3_xxs",
"--native",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"131072",
"--kv",
"int8",
"--mmap-experts"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-iq3_xxs.log",
"model_name": "qwen3.8-flash-next-iq3_xxs",
"port": 8080,
"tokenizer": "<T>/data/packs/iq3_xxs/tokenizer"
}
},
"32GB-2x24GB qwen Q2_0": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/q2_0",
"--native",
"<T>/models/Q2_0/Qwen3.8-Flash-Next-GSQ-RCO-Q2_0-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/Q2_0/Qwen3.8-Flash-Next-GSQ-RCO-Q2_0-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"131072",
"--kv",
"int8",
"--resident-experts"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-q2_0.log",
"model_name": "qwen3.8-flash-next-q2_0",
"port": 8080,
"tokenizer": "<T>/data/packs/q2_0/tokenizer"
}
},
"32GB-2x24GB qwen recommended": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/q2_0",
"--native",
"<T>/models/Q2_0/Qwen3.8-Flash-Next-GSQ-RCO-Q2_0-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/Q2_0/Qwen3.8-Flash-Next-GSQ-RCO-Q2_0-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"131072",
"--kv",
"int8",
"--resident-experts"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-q2_0.log",
"model_name": "qwen3.8-flash-next-q2_0",
"port": 8080,
"tokenizer": "<T>/data/packs/q2_0/tokenizer"
}
},
"32GB-2x24GB unsloth UD-Q4_K_XL": {
"code": 1,
"config": null
},
"47GB-2x16GB qwen IQ3_S": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/iq3_s",
"--native",
"<T>/models/IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"65536",
"--kv",
"int8",
"--mmap-experts"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-iq3_s.log",
"model_name": "qwen3.8-flash-next-iq3_s",
"port": 8080,
"tokenizer": "<T>/data/packs/iq3_s/tokenizer"
}
},
"47GB-2x16GB qwen IQ3_XXS": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/iq3_xxs",
"--native",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"65536",
"--kv",
"int8",
"--resident-experts"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-iq3_xxs.log",
"model_name": "qwen3.8-flash-next-iq3_xxs",
"port": 8080,
"tokenizer": "<T>/data/packs/iq3_xxs/tokenizer"
}
},
"47GB-2x16GB qwen Q2_0": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/q2_0",
"--native",
"<T>/models/Q2_0/Qwen3.8-Flash-Next-GSQ-RCO-Q2_0-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/Q2_0/Qwen3.8-Flash-Next-GSQ-RCO-Q2_0-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"65536",
"--kv",
"int8"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": [
0,
1
],
"gpus_asked": true,
"layer_split": "auto",
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-q2_0.log",
"model_name": "qwen3.8-flash-next-q2_0",
"port": 8080,
"tokenizer": "<T>/data/packs/q2_0/tokenizer"
}
},
"47GB-2x16GB qwen recommended": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/q2_0",
"--native",
"<T>/models/Q2_0/Qwen3.8-Flash-Next-GSQ-RCO-Q2_0-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/Q2_0/Qwen3.8-Flash-Next-GSQ-RCO-Q2_0-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"65536",
"--kv",
"int8"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": [
0,
1
],
"gpus_asked": true,
"layer_split": "auto",
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-q2_0.log",
"model_name": "qwen3.8-flash-next-q2_0",
"port": 8080,
"tokenizer": "<T>/data/packs/q2_0/tokenizer"
}
},
"47GB-2x16GB unsloth UD-Q4_K_XL": {
"code": 1,
"config": null
},
"64GB-1x32GB qwen IQ3_S": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/iq3_s",
"--native",
"<T>/models/IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"131072",
"--kv",
"int8"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-iq3_s.log",
"model_name": "qwen3.8-flash-next-iq3_s",
"port": 8080,
"tokenizer": "<T>/data/packs/iq3_s/tokenizer"
}
},
"64GB-1x32GB qwen IQ3_XXS": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/iq3_xxs",
"--native",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"131072",
"--kv",
"int8",
"--kv-resident",
"32768"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-iq3_xxs.log",
"model_name": "qwen3.8-flash-next-iq3_xxs",
"port": 8080,
"tokenizer": "<T>/data/packs/iq3_xxs/tokenizer"
}
},
"64GB-1x32GB qwen Q2_0": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/q2_0",
"--native",
"<T>/models/Q2_0/Qwen3.8-Flash-Next-GSQ-RCO-Q2_0-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/Q2_0/Qwen3.8-Flash-Next-GSQ-RCO-Q2_0-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"131072",
"--kv",
"int8",
"--kv-resident",
"32768"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-q2_0.log",
"model_name": "qwen3.8-flash-next-q2_0",
"port": 8080,
"tokenizer": "<T>/data/packs/q2_0/tokenizer"
}
},
"64GB-1x32GB qwen recommended": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/iq3_xxs",
"--native",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"131072",
"--kv",
"int8",
"--kv-resident",
"32768"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-iq3_xxs.log",
"model_name": "qwen3.8-flash-next-iq3_xxs",
"port": 8080,
"tokenizer": "<T>/data/packs/iq3_xxs/tokenizer"
}
},
"64GB-1x32GB unsloth UD-Q4_K_XL": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/unsloth-ud-q4_k_xl",
"--native",
"<T>/models/unsloth-UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"32768",
"--kv",
"int8",
"--resident-budget-gib",
"40"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-unsloth-ud-q4_k_xl.log",
"model_name": "qwen3.8-flash-next-unsloth-ud-q4_k_xl",
"port": 8080,
"tokenizer": "<T>/data/packs/unsloth-ud-q4_k_xl/tokenizer"
}
},
"96GB-1x16GB qwen IQ3_S": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/iq3_s",
"--native",
"<T>/models/IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"65536",
"--kv",
"int8",
"--kv-resident",
"32768"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-iq3_s.log",
"model_name": "qwen3.8-flash-next-iq3_s",
"port": 8080,
"tokenizer": "<T>/data/packs/iq3_s/tokenizer"
}
},
"96GB-1x16GB qwen IQ3_XXS": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/iq3_xxs",
"--native",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"65536",
"--kv",
"int8",
"--kv-resident",
"32768"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-iq3_xxs.log",
"model_name": "qwen3.8-flash-next-iq3_xxs",
"port": 8080,
"tokenizer": "<T>/data/packs/iq3_xxs/tokenizer"
}
},
"96GB-1x16GB qwen Q2_0": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/q2_0",
"--native",
"<T>/models/Q2_0/Qwen3.8-Flash-Next-GSQ-RCO-Q2_0-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/Q2_0/Qwen3.8-Flash-Next-GSQ-RCO-Q2_0-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"65536",
"--kv",
"int8",
"--kv-resident",
"32768"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-q2_0.log",
"model_name": "qwen3.8-flash-next-q2_0",
"port": 8080,
"tokenizer": "<T>/data/packs/q2_0/tokenizer"
}
},
"96GB-1x16GB qwen recommended": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/iq3_xxs",
"--native",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf",
"--ple-gguf",
"<T>/models/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"65536",
"--kv",
"int8",
"--kv-resident",
"32768"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-iq3_xxs.log",
"model_name": "qwen3.8-flash-next-iq3_xxs",
"port": 8080,
"tokenizer": "<T>/data/packs/iq3_xxs/tokenizer"
}
},
"96GB-1x16GB unsloth UD-Q4_K_XL": {
"code": 0,
"config": {
"args": [
"--pack",
"<T>/data/packs/unsloth-ud-q4_k_xl",
"--native",
"<T>/models/unsloth-UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf",
"--expert-profile",
"<T>/data/expert-profile.bin",
"--expert-cache",
"auto",
"--prefill",
"auto",
"--spec",
"4",
"--spec-min-p",
"0.5",
"--mtp",
"<T>/data/mtp/rt",
"--max-context",
"32768",
"--kv",
"int8",
"--resident-budget-gib",
"71"
],
"cwd": "<T>",
"exe": "<T>/engine/<EXE>",
"gpu": 0,
"gpus_asked": true,
"lib_dirs": [
"<cuda>"
],
"log": "<T>/strata-unsloth-ud-q4_k_xl.log",
"model_name": "qwen3.8-flash-next-unsloth-ud-q4_k_xl",
"port": 8080,
"tokenizer": "<T>/data/packs/unsloth-ud-q4_k_xl/tokenizer"
}
}
}
+208
View File
@@ -0,0 +1,208 @@
"""The owner's rule for setup (#403 #406 #364 #384): setup RECOMMENDS, it never forces - and the recommended answers
stay exactly what they were. setup.main() with --yes (and with Enter for every question) on a few PCs writes the same
run config, byte for byte, as 0.1.32 plus the fixes on top of it did (tools/test_setup_golden.json, written by that
setup). Every outside effect is mocked: no GPU, no downloads, nothing written outside a temp folder.
python -m unittest tools.test_setup_golden
python tools/test_setup_golden.py --write (only to record a new baseline on purpose)
"""
from __future__ import annotations
import contextlib
import io
import json
import sys
import tempfile
import types
import unittest
from pathlib import Path
from unittest import mock
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))
import setup # noqa: E402
GOLDEN = Path(__file__).with_name("test_setup_golden.json")
def card(i, name, vram, arch):
return {"index": i, "name": name, "vram_gb": vram, "arch": arch, "driver": "580.97"}
# the PCs: total RAM as ram_gb() reads it (a little under the label), the cards as nvidia-smi lists them
PROFILES = {
"64GB-1x32GB": (63.7, [card(0, "NVIDIA GeForce RTX 5090", 31.8, "120")]), # #406
"32GB-2x24GB": (31.9, [card(i, "NVIDIA GeForce RTX 3090", 24.0, "86") for i in range(2)]), # #364
"47GB-2x16GB": (47.0, [card(i, "NVIDIA GeForce RTX 5060 Ti", 15.9, "120") for i in range(2)]), # #384
"96GB-1x16GB": (95.8, [card(0, "NVIDIA GeForce RTX 5080", 15.9, "120")]),
"128GB-1x24GB": (127.8, [card(0, "NVIDIA GeForce RTX 4090", 24.0, "89")]),
}
# (family, model): None = the recommended size
MODELS = [("qwen", None), ("qwen", "Q2_0"), ("qwen", "IQ3_XXS"), ("qwen", "IQ3_S"), ("unsloth", "UD-Q4_K_XL")]
class FakeGGUF:
"""gguf_reader.GGUFFile: shard 2 holds the PLE table."""
def __init__(self, path):
names = ["per_layer_token_embd.weight"] if "00002-of" in str(path) else ["blk.0.ffn_up_exps.weight"]
self.tensors = [types.SimpleNamespace(name=n) for n in names]
def normalize(v, t: Path):
"""The config with the temp folder and the platform's names taken out (it compares on Windows and Linux)."""
if isinstance(v, dict):
return {k: normalize(x, t) for k, x in v.items()}
if isinstance(v, list):
return [normalize(x, t) for x in v]
if isinstance(v, str):
return v.replace(str(t), "<T>").replace("\\", "/").replace(setup.EXE, "<EXE>")
return v
def install(ram, found, argv, answers=None, extra=(), avx512=False, configs=()):
"""setup.main() on a mocked PC -> (exit code, printed text, the written config or None, the questions asked).
answers: None = --yes (a question fails the run), "" = Enter for every question, a list of answers in order, or
{words of a question: its answer} (Enter for the others).
extra: more patches (mock.patch objects). configs: (name, dict) run configs already in the Strata folder."""
with tempfile.TemporaryDirectory() as tmp:
t = Path(tmp)
(t / "data" / "mtp" / "rt").mkdir(parents=True)
(t / "data" / "mtp" / "rt" / "experts.bin").write_bytes(b"")
eng = t / "engine"
eng.mkdir()
(eng / "BUILD.json").write_text(json.dumps({"version": "0.1.32", "source": "local", "cuda_dirs": ["<cuda>"]}))
for name, c in configs:
(t / name).write_text(json.dumps(c))
asked = []
def fake_input(prompt=""):
asked.append(prompt)
if answers is None:
raise AssertionError(f"asked {prompt!r} with --yes")
if isinstance(answers, list):
return answers.pop(0) if answers else ""
if isinstance(answers, dict): # {words of the question: answer}, else Enter
return next((v for k, v in answers.items() if k in prompt), "")
return answers
def fake_download(url, dst, what=None):
dst.parent.mkdir(parents=True, exist_ok=True)
dst.write_bytes(b"")
setup.mark(dst)
patches = [
mock.patch.object(setup, "ROOT", t),
mock.patch.object(setup, "GPU_PICK", None),
mock.patch.object(setup, "data_folder", lambda d: (t / "data", [])),
mock.patch.object(setup, "load_settings", lambda: {}),
mock.patch.object(setup, "save_settings", lambda s: None),
mock.patch.object(setup, "gpus", lambda: found),
mock.patch.object(setup, "amd_gpus", lambda: []),
mock.patch.object(setup, "ram_gb", lambda: ram),
mock.patch.object(setup, "cpu_info", lambda: ("Test CPU", True, avx512)),
mock.patch.object(setup, "page_file_gb", lambda: 16.0),
mock.patch.object(setup, "is_wsl", lambda: False),
mock.patch.object(setup, "free_gb", lambda p: 900.0),
mock.patch.object(setup, "pip_install", lambda *a, **k: None),
mock.patch.object(setup, "get_llama_cpp", lambda: t / "llama.cpp"),
mock.patch.object(setup, "get_prebuilt", lambda *a, **k: eng),
mock.patch.object(setup, "update_installed_engine", lambda *a, **k: None),
mock.patch.object(setup, "download", fake_download),
mock.patch.object(setup, "check_shards", lambda shards: None),
mock.patch.object(setup, "verify_sha256", lambda *a: None),
mock.patch.object(setup, "run", lambda *a, **k: None),
mock.patch.object(setup, "mtp_corrupt", lambda *a, **k: False),
mock.patch.object(setup, "refresh_draft_vocab", lambda *a, **k: None),
mock.patch.object(setup, "write_run_script", lambda tag, cfg, port: t / f"run-{tag}.bat"),
mock.patch.object(setup, "saved_calibration", lambda cfg: None),
mock.patch.object(setup, "calibrate_config", mock.Mock(side_effect=AssertionError("calibrated"))),
mock.patch.dict(sys.modules, {"gguf_reader": types.SimpleNamespace(GGUFFile=FakeGGUF)}),
mock.patch.object(sys, "argv", ["setup.py", "--models-dir", str(t / "models"), *argv]
+ (["--yes"] if answers is None else [])),
mock.patch("builtins.input", fake_input),
*extra,
]
out = io.StringIO()
code = None
with contextlib.ExitStack() as st:
for p in patches:
st.enter_context(p)
with contextlib.redirect_stdout(out):
try:
code = setup.main()
except SystemExit as e:
code = e.code
written = sorted(t.glob("strata-*.json"), key=lambda p: p.stat().st_mtime)
cfg = None
if written and code == 0:
cfg = normalize(json.loads(written[-1].read_text(encoding="utf-8")), t)
return code, out.getvalue(), cfg, asked
def argv_for(family, model):
return ["--family", family, "--no-start"] + (["--model", model] if model else [])
def record() -> dict:
"""Every profile x model with --yes: the exit code and the config (the baseline this test compares against)."""
res = {}
for prof, (ram, found) in PROFILES.items():
for family, model in MODELS:
code, out, cfg, _ = install(ram, found, argv_for(family, model))
res[f"{prof} {family} {model or 'recommended'}"] = {"code": code, "config": cfg}
return res
class Golden(unittest.TestCase):
"""--yes and Enter: the same config as the baseline wherever the baseline wrote one."""
@classmethod
def setUpClass(cls):
cls.golden = json.loads(GOLDEN.read_text(encoding="utf-8"))
def cases(self):
for prof, (ram, found) in PROFILES.items():
for family, model in MODELS:
key = f"{prof} {family} {model or 'recommended'}"
if self.golden[key]["code"] == 0:
yield key, ram, found, family, model
def test_the_baseline_covers_every_kind_of_pc(self):
written = [k for k, v in self.golden.items() if v["code"] == 0]
self.assertGreaterEqual(len(written), 20)
lowram_multi = self.golden["32GB-2x24GB qwen IQ3_XXS"]["config"] # #364: low-RAM, two cards -> one
self.assertIn("--resident-experts" if "--resident-experts" in lowram_multi["args"] else "--mmap-experts",
lowram_multi["args"])
self.assertNotIsInstance(lowram_multi.get("gpu"), list)
def test_yes(self):
for key, ram, found, family, model in self.cases():
with self.subTest(key):
code, out, cfg, asked = install(ram, found, argv_for(family, model))
self.assertEqual(code, 0, out[-3000:])
self.assertEqual(cfg, self.golden[key]["config"], out[-3000:])
self.assertEqual(asked, [])
def test_enter_for_every_question(self):
for key, ram, found, family, model in self.cases():
with self.subTest(key):
code, out, cfg, asked = install(ram, found, argv_for(family, model), answers="")
self.assertEqual(code, 0, out[-3000:])
self.assertEqual(cfg, self.golden[key]["config"], out[-3000:])
def test_the_refusals_with_yes_alone_stay(self):
"""A size the baseline refused with --yes and no explicit --model still stops (--yes alone is no consent)."""
for prof, (ram, found) in PROFILES.items():
for family, model in MODELS:
key = f"{prof} {family} {model or 'recommended'}"
if self.golden[key]["code"] != 0 and model is None:
with self.subTest(key):
self.assertNotEqual(install(ram, found, argv_for(family, model))[0], 0)
if __name__ == "__main__":
if "--write" in sys.argv:
GOLDEN.write_text(json.dumps(record(), indent=1, sort_keys=True) + "\n", encoding="utf-8")
print(f"wrote {GOLDEN}")
else:
unittest.main()
+4 -2
View File
@@ -46,8 +46,10 @@ class OneGpuWhy(unittest.TestCase):
need = arena + setup.LOW_RAM_HEADROOM_GB
self.assertIn(f"{arena:.0f} + {setup.LOW_RAM_HEADROOM_GB} = {need:.0f} GB", text)
self.assertIn("this PC has 46 GB", text)
self.assertIn("layer split", text) # why one GPU
self.assertIn("--low-ram off", text) # and the way to keep them all
self.assertIn("layer split", text) # why one GPU is recommended
self.assertIn("--gpus 0,1", text) # #364 #384: and the way to use them all
self.assertIn("OS file cache", text)
self.assertNotIn("--low-ram off", text) # (that pages the experts: not the way)
def test_an_explicit_choice_says_so(self):
text = "\n".join(setup.low_ram_one_gpu_why("Q2_0", 64, "resident"))
+330
View File
@@ -0,0 +1,330 @@
"""Tests for the owner's rule in setup.py - it recommends, it never forces: a choice bigger than the recommendation is
kept and its risk said (#406's 256K on 64 GB, #364/#384's two GPUs in the low-RAM mode, #403's RAM budget), and the
stops that stay are the ones a user can confirm (confirm_risk: --yes with an explicit flag, or y). The defaults are
tools/test_setup_golden.py's. Mocked - no GPU, no downloads, nothing written outside a temp folder.
python -m unittest tools.test_setup_risk
"""
from __future__ import annotations
import contextlib
import io
import json
import sys
import tempfile
import unittest
from pathlib import Path
from unittest import mock
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))
sys.path.insert(0, str(ROOT / "tools"))
import setup # noqa: E402
from test_setup_golden import PROFILES, card, install # noqa: E402
def arg(cfg, flag):
a = cfg["args"]
return a[a.index(flag) + 1] if flag in a else None
def run(fn, *args, stdin=None):
"""-> (exit code or None, printed text, questions asked); stdin answers every input() (None: never asked)."""
out, asked, code = io.StringIO(), [], None
def fake_input(prompt=""):
asked.append(prompt)
if stdin is None:
raise AssertionError(f"asked {prompt!r} with --yes")
return stdin
with contextlib.redirect_stdout(out), mock.patch("builtins.input", fake_input):
try:
fn(*args)
except SystemExit as e:
code = e.code
return code, out.getvalue(), asked
class ConfirmRisk(unittest.TestCase):
"""S6: one helper for the stops a user may take on."""
def go(self, explicit, yes, stdin=None):
return run(setup.confirm_risk, "it may not fit", explicit, yes, "it does not fit", "a smaller size",
stdin=stdin)
def test_yes_with_an_explicit_choice_is_consent(self):
code, out, asked = self.go(True, True)
self.assertIsNone(code)
self.assertIn("it may not fit", out)
self.assertEqual(asked, [])
def test_yes_alone_keeps_the_stop(self):
code, out, asked = self.go(False, True)
self.assertEqual(code, 1)
self.assertIn("it does not fit", out)
self.assertIn("a smaller size", out)
def test_interactive_default_is_no(self):
for explicit in (True, False):
code, out, asked = self.go(explicit, False, stdin="")
self.assertEqual(code, 1)
self.assertIn("[n]", asked[0])
self.assertIsNone(self.go(explicit, False, stdin="y")[0])
def test_paging_with_an_explicit_model(self):
code, out, asked = run(setup.confirm_paging, "IQ3_XXS", 54, "auto", True, True)
self.assertIsNone(code, out)
self.assertIn("installing IQ3_XXS with 54 GB of RAM, as you chose (--model)", out)
class Context(unittest.TestCase):
"""S1 (#406 #364): the RAM rule recommends, an explicit or picked context is kept with a note."""
RAM64, GPU32 = PROFILES["64GB-1x32GB"]
def test_the_ram_rule(self):
self.assertEqual(setup.ram_ctx("IQ3_S", 63.7), 131072)
self.assertEqual(setup.ram_ctx("IQ3_XXS", 63.7), 131072)
self.assertEqual(setup.ram_ctx("IQ3_XXS", 95.8), 524288) # 43 + 7.2 + 24 GB fits 96
self.assertEqual(setup.ram_ctx("IQ3_S", 76.5), 131072)
self.assertEqual(setup.ram_ctx("IQ3_S", 78.5), 262144)
self.assertEqual(setup.ram_ctx("Q2_0", 31.9), 524288) # other sizes: no RAM rule
self.assertEqual(setup.ram_ctx("IQ3_XXS", 31.9, low_ram=True), 524288) # the KV cache is in VRAM there
self.assertIsNone(setup.ctx_ram_need("IQ3_XXS", 262144, low_ram=True))
self.assertAlmostEqual(setup.ctx_ram_need("IQ3_S", 262144), 77.9, places=1)
def test_an_explicit_256k_is_kept(self):
code, out, cfg, _ = install(self.RAM64, self.GPU32, ["--family", "qwen", "--model", "IQ3_S", "--no-start",
"--context", "262144"])
self.assertEqual(code, 0, out)
self.assertEqual(arg(cfg, "--max-context"), "262144")
self.assertNotIn("--rope-scaling", cfg["args"])
self.assertIn("256K with IQ3_S needs ~78 GB of RAM by setup's estimate", out)
self.assertIn("this PC has 64. Kept as you chose: it may be slower or run out of RAM under load. 128K is the "
"recommended size.", out)
def test_a_picked_256k_is_kept_and_the_menu_says_the_risk(self):
code, out, cfg, asked = install(self.RAM64, self.GPU32, ["--family", "qwen", "--model", "IQ3_S", "--no-start"],
answers={"Context?": "5"})
self.assertEqual(code, 0, out)
self.assertEqual(arg(cfg, "--max-context"), "262144")
self.assertIn("256K tokens (needs ~78 GB RAM, this PC has 64: may run out of memory)", out)
self.assertIn("128K tokens (recommended for your GPU)\n", out)
self.assertIn("Kept as you chose", out)
def test_low_ram_mode_keeps_262k_without_a_ram_note(self):
ram, found = PROFILES["32GB-2x24GB"] # #364
code, out, cfg, _ = install(ram, found, ["--family", "qwen", "--model", "IQ3_XXS", "--no-start",
"--context", "262144"])
self.assertEqual(code, 0, out)
self.assertEqual(arg(cfg, "--max-context"), "262144")
self.assertNotIn("Kept as you chose: it may be slower", out)
def test_the_earlier_install_keeps_its_context(self):
"""An update (a new copy of Strata) set up like the earlier install keeps its 256K instead of capping it."""
with tempfile.TemporaryDirectory() as d:
prev = Path(d) / "strata-iq3_s.json"
prev.write_text(json.dumps({"args": ["--max-context", "262144", "--kv", "int8"], "port": 8080}))
started = mock.Mock(return_value=0)
code, out, cfg, _ = install(self.RAM64, self.GPU32, [], extra=[
mock.patch.object(setup, "previous_config", lambda *a: prev),
mock.patch.object(setup, "start", started)])
self.assertEqual(code, 0, out)
self.assertEqual(arg(cfg, "--max-context"), "262144")
self.assertIn("Kept as you chose", out)
self.assertTrue(started.called)
class LowRamGpus(unittest.TestCase):
"""S2/S3 (#364 #384): one GPU recommended in the low-RAM mode, all of them when asked for."""
def test_explicit_gpus_are_kept_with_the_mapped_variant(self):
for prof, model in (("32GB-2x24GB", "IQ3_XXS"), ("32GB-2x24GB", "Q2_0"), ("47GB-2x16GB", "IQ3_XXS")):
with self.subTest(prof=prof, model=model):
ram, found = PROFILES[prof]
code, out, cfg, _ = install(ram, found, ["--family", "qwen", "--model", model, "--no-start",
"--gpus", "0,1"])
self.assertEqual(code, 0, out)
self.assertEqual(cfg["gpu"], [0, 1])
self.assertEqual(cfg["layer_split"], "auto")
self.assertIn("--mmap-experts", cfg["args"])
self.assertNotIn("--resident-experts", cfg["args"])
self.assertIn("as you chose (--gpus)", out)
self.assertIn("RAM can fill up to 0 free", out)
self.assertIn("low-RAM mode on 2 GPUs", out)
def test_the_share_counts_every_card(self):
ram, found = PROFILES["47GB-2x16GB"] # #384: 2 x 16 GB, 47 GB, IQ3_XXS at 64K
code, out, cfg, _ = install(ram, found, ["--family", "qwen", "--model", "IQ3_XXS", "--no-start",
"--gpus", "0,1"])
one = setup.low_ram_gpu_gb("IQ3_XXS", 15.9, 65536, "int8")
self.assertIn(f"the GPUs hold ~{100 * 2 * one / setup.MODELS['IQ3_XXS']['arena_gb']:.0f}% of them", out)
def test_asked_and_answered_two(self):
ram, found = PROFILES["32GB-2x24GB"]
code, out, cfg, asked = install(ram, found, ["--family", "qwen", "--model", "Q2_0", "--no-start"],
answers={"Low-RAM mode: which GPUs?": "2"})
self.assertEqual(code, 0, out)
self.assertTrue(any("Low-RAM mode: which GPUs? [1]" in q for q in asked), asked)
self.assertEqual(cfg["gpu"], [0, 1])
self.assertIn("--mmap-experts", cfg["args"])
self.assertIn("1) GPU 0 (NVIDIA GeForce RTX 3090, 24 GB) only", out)
def test_yes_and_enter_keep_one_gpu(self):
ram, found = PROFILES["32GB-2x24GB"]
for answers in (None, ""):
code, out, cfg, _ = install(ram, found, ["--family", "qwen", "--model", "Q2_0", "--no-start"],
answers=answers)
self.assertEqual(code, 0, out)
self.assertEqual(cfg["gpu"], 0)
self.assertIn("--resident-experts", cfg["args"])
def test_low_ram_resident_with_gpus(self):
ram, found = PROFILES["32GB-2x24GB"]
code, out, cfg, _ = install(ram, found, ["--family", "qwen", "--model", "Q2_0", "--no-start", "--gpus", "0,1",
"--low-ram", "resident"])
self.assertEqual(code, 0, out)
self.assertEqual(cfg["gpu"], [0, 1])
self.assertIn("--mmap-experts", cfg["args"])
self.assertIn("--low-ram resident has no layer split yet", out)
def test_low_ram_resident_alone_keeps_one_gpu_without_asking(self):
ram, found = PROFILES["32GB-2x24GB"]
code, out, cfg, asked = install(ram, found, ["--family", "qwen", "--model", "Q2_0", "--no-start",
"--low-ram", "resident"], answers="")
self.assertEqual(code, 0, out)
self.assertEqual(cfg["gpu"], 0)
self.assertFalse(any("Low-RAM mode" in q for q in asked), asked)
class StartOnSeveralGpus(unittest.TestCase):
"""A resident low-RAM config started on several GPUs reads the experts through the file cache (#364 #384)."""
def test_split_mmap(self):
cfg = {"args": ["--pack", "p", "--resident-experts", "--kv", "int8"]}
out = io.StringIO()
with contextlib.redirect_stdout(out):
self.assertTrue(setup.split_mmap(cfg))
self.assertFalse(setup.split_mmap(cfg))
self.assertFalse(setup.split_mmap({"args": ["--mmap-experts"]}))
self.assertEqual(cfg["args"], ["--pack", "p", "--mmap-experts", "--kv", "int8"])
self.assertIn("no layer split yet", out.getvalue())
def offer(self, args, stdin):
found = PROFILES["32GB-2x24GB"][1]
with tempfile.TemporaryDirectory() as d:
p = Path(d) / "strata-q2_0.json"
cfg = {"args": list(args)}
with mock.patch.object(setup, "gpus", lambda: found), \
mock.patch.object(setup, "engine_runs_on", lambda g: True):
code, out, asked = run(setup.offer_together, p, cfg, stdin is None, stdin=stdin)
return code, out, asked, json.loads(p.read_text())
def test_offer_together_recommends_one_gpu_for_a_resident_config(self):
code, out, asked, cfg = self.offer(["--resident-experts"], None) # --yes: the recommendation
self.assertIsNone(code, out)
self.assertNotIn("gpu", cfg)
self.assertEqual(cfg["args"], ["--resident-experts"])
code, out, asked, cfg = self.offer(["--resident-experts"], "y")
self.assertIn("[n]", asked[0])
self.assertEqual(cfg["gpu"], [0, 1])
self.assertEqual(cfg["args"], ["--mmap-experts"])
code, out, asked, cfg = self.offer(["--mmap-experts"], None) # other configs: as before
self.assertEqual(cfg["gpu"], [0, 1])
def test_start_with_gpus(self):
found = PROFILES["32GB-2x24GB"][1]
with tempfile.TemporaryDirectory() as d:
exe = Path(d) / "strata.exe"
exe.write_bytes(b"")
p = Path(d) / "strata-q2_0.json"
p.write_text(json.dumps({"exe": str(exe), "args": ["--resident-experts"], "gpu": 0, "gpus_asked": True}))
call = mock.Mock(return_value=0)
with mock.patch.object(setup, "gpus", lambda: found), \
mock.patch.object(setup, "ensure_engine_for", lambda cards, path, cfg, yes: cfg), \
mock.patch.object(setup, "is_wsl", lambda: False), \
mock.patch.object(setup.subprocess, "call", call):
code, out, _ = run(setup.start, p, None, [0, 1], False, True)
cfg = json.loads(p.read_text())
self.assertIsNone(code, out)
self.assertEqual(cfg["gpu"], [0, 1])
self.assertEqual(cfg["args"], ["--mmap-experts"])
self.assertIn("no layer split yet", out)
self.assertTrue(call.called)
class SmallCard(unittest.TestCase):
"""S9: a card under 8 GB named with --gpus is a risk to confirm, not a stop."""
FOUND = [card(0, "NVIDIA GeForce RTX 3090", 24.0, "86"), card(1, "NVIDIA GeForce RTX 2060", 6.0, "75")]
def test_named_with_yes(self):
code, out, cfg, _ = install(63.7, self.FOUND, ["--family", "qwen", "--model", "Q2_0", "--no-start",
"--gpus", "0,1"])
self.assertEqual(code, 0, out)
self.assertEqual(cfg["gpu"], [0, 1])
self.assertIn("GPU 1 (NVIDIA GeForce RTX 2060) has 6 GB of VRAM", out)
self.assertIn("is used together with the others, as you chose", out)
def test_named_and_enter_stops(self):
code, out, cfg, asked = install(63.7, self.FOUND, ["--family", "qwen", "--model", "Q2_0", "--no-start",
"--gpus", "0,1"], answers="")
self.assertEqual(code, 1)
self.assertTrue(any("Use it anyway?" in q for q in asked), asked)
def test_not_named_is_not_offered(self):
code, out, cfg, _ = install(63.7, self.FOUND, ["--family", "qwen", "--model", "Q2_0", "--no-start"])
self.assertEqual(code, 0, out)
self.assertEqual(cfg["gpu"], 0) # one card: as before
class RamFloor(unittest.TestCase):
"""S7: less RAM than the smallest model needs: a stop with --yes alone, a risk with --model."""
FOUND = [card(0, "NVIDIA GeForce RTX 3060", 8.0, "86")]
def test_yes_alone_stops(self):
code, out, cfg, _ = install(19.9, self.FOUND, ["--family", "qwen", "--no-start"])
self.assertEqual(code, 1)
self.assertIn("--model NAME --yes", out)
def test_an_explicit_model_goes_on(self):
code, out, cfg, _ = install(19.9, self.FOUND, ["--family", "coder", "--model", "IQ1_M", "--no-start"])
self.assertEqual(code, 0, out)
self.assertIn("going on with 20 GB of RAM, as you chose", out)
class KvStreaming(unittest.TestCase):
"""8: --kv-streaming on|off|auto (auto: the RAM test, as before)."""
RAM, FOUND = PROFILES["64GB-1x32GB"]
def go(self, model, *flags):
return install(self.RAM, self.FOUND, ["--family", "qwen", "--model", model, "--no-start", *flags])
def test_off(self):
code, out, cfg, _ = self.go("IQ3_XXS", "--kv-streaming", "off")
self.assertEqual(code, 0, out)
self.assertNotIn("--kv-resident", cfg["args"])
self.assertIn("KV streaming off, as you chose", out)
def test_on_past_the_ram_test(self):
code, out, cfg, _ = self.go("IQ3_S", "--kv-streaming", "on") # auto leaves it off on 64 GB
self.assertEqual(code, 0, out)
self.assertEqual(arg(cfg, "--kv-resident"), "32768")
self.assertIn("Kept as you chose (--kv-streaming on)", out)
def test_on_where_it_cannot(self):
code, out, cfg, _ = self.go("Q2_0", "--kv-streaming", "on", "--kv", "k8v4")
self.assertNotIn("--kv-resident", cfg["args"])
self.assertIn("it refuses the pair", out)
code, out, cfg, _ = self.go("Q2_0", "--kv-streaming", "on", "--context", "32768")
self.assertNotIn("--kv-resident", cfg["args"])
self.assertIn("a context under 64K is not streamed", out)
def test_budget_flag_on_another_size(self):
code, out, cfg, _ = self.go("Q2_0", "--resident-budget-gib", "30")
self.assertEqual(code, 0, out)
self.assertNotIn("--resident-budget-gib", cfg["args"])
self.assertIn("--resident-budget-gib is for UD-Q4_K_XL", out)
if __name__ == "__main__":
unittest.main()
+38 -3
View File
@@ -139,7 +139,7 @@ class Main(unittest.TestCase):
def tearDown(self):
self.tmp.cleanup()
def main(self, argv, ram=63.7, version="0.1.32", n_gpus=1):
def main(self, argv, ram=63.7, version="0.1.32", n_gpus=1, model=True):
eng = self.t / "engine"
eng.mkdir(exist_ok=True)
(eng / "BUILD.json").write_text(json.dumps({"version": version, "source": "local"}))
@@ -178,7 +178,8 @@ class Main(unittest.TestCase):
mock.patch.object(setup, "saved_calibration", lambda cfg: None),
mock.patch.object(setup, "start", mock.Mock(side_effect=AssertionError("started"))),
mock.patch.dict(sys.modules, {"gguf_reader": types.SimpleNamespace(GGUFFile=FakeGGUF)}),
mock.patch.object(sys, "argv", ["setup.py", "--family", "unsloth", "--model", M, "--yes", "--no-start",
mock.patch.object(sys, "argv", ["setup.py", "--family", "unsloth", *(["--model", M] if model else []),
"--yes", "--no-start",
"--models-dir", str(self.t / "models"), *argv]),
mock.patch("builtins.input", mock.Mock(side_effect=AssertionError("asked"))),
]
@@ -238,11 +239,45 @@ class Main(unittest.TestCase):
self.assertIsNone(cfg)
def test_too_little_ram(self):
code, out, cfg = self.main(["--context", "8192"], ram=31.9)
code, out, cfg = self.main(["--context", "8192"], ram=31.9, model=False) # --yes alone: still a stop
self.assertEqual(code, 1)
self.assertIn("needs 48 GB of RAM or more", out)
self.assertIn("--model UD-Q4_K_XL --yes", out) # the way to insist
self.assertEqual(self.downloads, [])
def test_too_little_ram_with_an_explicit_model_installs(self):
"""S6 (the owner's rule): --model with --yes is the consent; the risk is said."""
code, out, cfg = self.main(["--context", "8192"], ram=31.9)
self.assertEqual(code, 0, out)
self.assertIn("needs 48 GB of RAM or more; this PC has 32 GB", out)
self.assertIn("installing UD-Q4_K_XL with 32 GB of RAM, as you chose", out)
self.assertEqual(cfg["args"][cfg["args"].index("--resident-budget-gib") + 1], "8")
def test_budget_flag(self):
"""S4: --resident-budget-gib N is kept; more than the recommendation says what it risks."""
code, out, cfg = self.main(["--context", "8192", "--resident-budget-gib", "48"])
self.assertEqual(code, 0, out)
self.assertEqual(cfg["args"][cfg["args"].index("--resident-budget-gib") + 1], "48")
self.assertIn("more than setup recommends for this PC (40 GiB", out)
self.assertIn("Kept as you chose", out)
code, out, cfg = self.main(["--context", "8192", "--resident-budget-gib", "32.5"])
self.assertEqual(cfg["args"][cfg["args"].index("--resident-budget-gib") + 1], "32.5")
self.assertNotIn("more than setup recommends", out)
def test_budget_flag_with_kv_streaming_is_kept(self):
code, out, cfg = self.main(["--context", "131072", "--resident-budget-gib", "40"])
self.assertEqual(code, 0, out)
args = cfg["args"]
self.assertIn("--kv-resident", args)
self.assertEqual(args[args.index("--resident-budget-gib") + 1], "40") # not 38: the user's number
self.assertIn("come on top of your 40 GiB RAM budget", out)
def test_budget_flag_needs_a_positive_number(self):
with contextlib.redirect_stderr(io.StringIO()):
code, out, cfg = self.main(["--context", "8192", "--resident-budget-gib", "0"])
self.assertEqual(code, 2) # argparse: N > 0
self.assertIsNone(cfg)
def test_one_gpu_and_no_images(self):
code, out, cfg = self.main(["--context", "8192", "--gpus", "0,1", "--vision", "yes", "--low-ram", "on"],
n_gpus=2)