[Docs] Explain DFlash2 selection during Metal setup

Refs #6174
This commit is contained in:
Виктор Быстров committed 2026-11-19 11:59:15 +05:00
1 parent 58ee322772
commit 3773be472d
2 files changed
+18 -17

No files matched your search

+10 -8
View File
@@ -69,8 +69,8 @@ rule.
together, so the SSD reads an expert with one request. On the 32 GB M4 that is about 17% faster decoding and 30% faster prompts
with the same tokens. Setup writes it only when the disk has room for it plus 10 GB, otherwise it warns, and it does not write
it on a Mac with 96 GB or more.
- Setup configures such a Mac without the draft layer (one token per step is faster there). A streaming Mac with 96 GB or more
keeps the draft layer and writes `--spec 3`.
- Setup skips the MTP draft layer on such a Mac. DFlash2 is still available for compatible packs. If neither drafter is
available, the model generates one token per step. A streaming Mac with 96 GB or more keeps the MTP layer and writes `--spec 3`.
- Prompts stream in chunks of 4096 on a streaming Mac with 96 GB or more, and 1024 on a smaller one. `STRATA_METAL_PROMPT_CHUNK=N`
sets it.
- The model's file must be on the internal SSD. An external disk is untested and likely much slower.
@@ -93,12 +93,14 @@ What the first run does (each step is skipped when it is already done):
3. **Python packages** into `.venv`. CMake and Ninja come from pip too, installed just before the build.
4. **Builds the engine** (`build-metal/strata`) with Apple's metal-cpp headers (pinned by SHA-256).
5. **Downloads the model.** The download resumes if interrupted. `--gguf-dir` uses files you already have.
6. **Prepares the model:** the pack (seconds) and the MTP draft layer (about 5 GB of the original checkpoint). On a Mac that
streams, the experts' copy takes the draft layer's place (about 3 minutes on the M4).
For UD-Q4_K_XL and UD-IQ4_XS-v31 it also downloads the DFlash2 drafter (0.34 GB, from Strata's signed update feed): the server then drafts
with DFlash2 instead of the MTP layer (`--spec 6`, `--draft-conf 0.7`; Apache-2.0, a copy of incoai/Qwen3.8-Flash-Next-DFlash2 that Strata
tuned, notice in `data/dflash2-tuned/`). With no internet the download is skipped without a word and the MTP runs as before;
`./setup.sh --setup` fetches it later. IQ3_S and the other sets keep the MTP.
6. **Prepares the model.** Setup makes the pack (seconds) and prepares the MTP draft layer where it fits (about 5 GB of the
original checkpoint). A streaming Mac below 96 GB skips MTP and makes the experts' copy (about 3 minutes on the M4).
Auto also fetches DFlash2 for compatible Qwen3.8-Flash-Next packs. Q2_0 and IQ3_XXS get the stock drafter (1.2 GB).
UD-Q4_K_XL and UD-IQ4_XS-v31 prefer the tuned drafter (0.34 GB from Strata's signed update feed) and can use the stock drafter
if the tuned one is unavailable. The tuned drafter uses `--spec 6` and `--draft-conf 0.7`. It is based on
incoai/Qwen3.8-Flash-Next-DFlash2 and licensed under Apache-2.0. IQ3_S selects MTP.
If DFlash2 is missing, the server uses MTP when it is available. `./setup.sh --setup` can fetch the drafter later.
[DFlash2 license notice](../terminal/data/dflash2-tuned/NOTICE.md)
7. **Writes `strata-<model>.json` and `run-<model>.sh`, then starts the server.**
After that, `./setup.sh` or `./run-q2_0.sh` starts the model directly. The server is the same as on a PC: the OpenAI-compatible
+8 -9
View File
@@ -334,9 +334,10 @@ def start(cfg_path: Path, port: int | None, open_browser: bool = True) -> int:
# ------------------------------------------------------------------------------------------------ the DFlash2 drafter
def fetch_drafter(model_name: str, data: Path) -> Path | None:
"""The DFlash2 drafter of a set whose Mac default is DFlash2 (strata_control/drafting.py SET_DEFAULTS: UD-Q4_K_XL and UD-IQ4_XS-v31): the tuned one (0.34 GB), else the stock one
(1.2 GB), through the normal download path (resumable, the pinned size and SHA-256). Offline, or an address that does not answer: nothing is said and the model keeps the MTP
(owner, strata-offline-users). A fault that is the person's to know (a file that failed its safety check) is one plain line. Never stops the setup. None when it is not here."""
"""Fetch the drafter when Auto selects DFlash2 on Metal. Prefer the tuned pack where available.
Setup continues if the download is unavailable. The server can use MTP at startup if its layer was prepared.
"""
from strata_control import acquisition, drafting, drafting_fetch
if drafting.choice_of("auto", model_name=model_name, backend="metal") != "dflash2":
return None
@@ -350,7 +351,7 @@ def fetch_drafter(model_name: str, data: Path) -> Path | None:
try:
got = drafting_fetch.ensure_for(data, model_name=model_name, backend="metal", progress=show)
except (drafting_fetch.DraftingError, acquisition.AcquisitionRefused, OSError) as exc:
S.warn(f"{exc} This model keeps using the MTP.")
S.warn(f"{exc} Setup will continue.")
return None
if got is not None:
S.ok(f"DFlash2 drafter: {got}")
@@ -569,11 +570,9 @@ def main(argv=None) -> int:
stream = streams(model, info["ram_gb"])
use_mtp = stream_mtp(stream, info["ram_gb"])
if stream and not use_mtp:
S.ok("the experts will stream from the SSD: no MTP draft layer (one token per step is faster there); "
"./setup.sh --setup on a Mac with more memory adds it")
S.ok("the experts will stream from the SSD. Setup skips the MTP draft layer on this Mac.")
elif stream:
S.ok(f"the experts will stream from the SSD; the MTP draft layer stays on, with --spec {STREAM_SPEC} "
"(a longer window pays when every window has a fixed cost per layer)")
S.ok(f"the experts will stream from the SSD. The MTP draft layer is prepared with --spec {STREAM_SPEC}.")
if stream and info["ram_gb"] < STREAM_MTP_FROM_GB:
experts_file(shards[0]) # a small Mac: its misses are many; a big Mac's arena holds most experts
if use_mtp and not (mtp / "mtp-q2_0.gguf").exists():
@@ -588,7 +587,7 @@ def main(argv=None) -> int:
S.refresh_draft_vocab(rt, a.draft_vocab or "cjk")
S.ok(f"MTP draft layer: {mtp / 'mtp-q2_0.gguf'}")
fetch_drafter(f"{fam['name']}-{model.lower()}", pack.parent.parent) # DFlash2 is this set's default drafter (the MTP above stays as the fallback); the folder a start looks in
fetch_drafter(f"{fam['name']}-{model.lower()}", pack.parent.parent) # the data folder the server checks for DFlash2
# ---- 7. the config, the start script
S.step(7, "writing the start script")