Skip to content

The agent that grows with you

fix(local-models): draft Flash Next from ggml-org's MTP head

emozillaa53e29f36e2e
diff --git a/hermes_cli/local_runtime/catalog.json b/hermes_cli/local_runtime/catalog.json
index e823ce0b3c9..5b098955482 100644
--- a/hermes_cli/local_runtime/catalog.json
+++ b/hermes_cli/local_runtime/catalog.json
@@ -78,8 +78,9 @@
"local": "mmproj-Qwen3.8-Flash-Next-BF16.gguf"
},
"mtp_head": {
- "path": "MTP/mtp-Qwen3.8-Flash-Next-Q8_0.gguf",
- "size_bytes": 4137429120
+ "repo": "ggml-org/Qwen3.8-Flash-Next-GGUF",
+ "path": "mtp-Qwen3.8-Flash-Next-Q8_0.gguf",
+ "size_bytes": 4137429280
},
"min_engine": "b11370",
"quality": 95,
diff --git a/hermes_cli/local_runtime/catalog.py b/hermes_cli/local_runtime/catalog.py
index 0f62023089d..7660140b591 100644
--- a/hermes_cli/local_runtime/catalog.py
+++ b/hermes_cli/local_runtime/catalog.py
@@ -38,6 +38,7 @@ class AssetFile:
path: str # repo-relative (may include a subdir)
size_bytes: int
local: str | None = None
+ repo: str | None = None # HF repo when it is not the entry's own (a companion published elsewhere)
@property
def local_name(self) -> str:
@@ -278,7 +279,8 @@ _last_refresh_attempt = 0.0
def _asset_from(d: "dict | None") -> "AssetFile | None":
if not d:
return None
- return AssetFile(path=d["path"], size_bytes=int(d["size_bytes"]), local=d.get("local"))
+ return AssetFile(path=d["path"], size_bytes=int(d["size_bytes"]), local=d.get("local"),
+ repo=d.get("repo"))
# Scalar CatalogEntry fields parsed from JSON: key -> (coerce, default); None default = required.
diff --git a/hermes_cli/web_routers/local_models.py b/hermes_cli/web_routers/local_models.py
index ff512f5b14b..d1e43d9d550 100644
--- a/hermes_cli/web_routers/local_models.py
+++ b/hermes_cli/web_routers/local_models.py
@@ -419,7 +419,7 @@ def _variant_files_on_disk(model_id: str) -> "list[Path]":
def _download_plan(entry, variant) -> list:
"""Everything a variant needs: split parts + mmproj/draft/MTP head assets, as (url, dest, bytes) tuples."""
plan = [(_hf_url(entry.repo, a.path), bootstrap.models_dir() / a.local_name, a.size_bytes) for a in variant.files]
- plan += [(_hf_url(entry.repo, a.path), bootstrap.assets_dir() / a.local_name, a.size_bytes)
+ plan += [(_hf_url(a.repo or entry.repo, a.path), bootstrap.assets_dir() / a.local_name, a.size_bytes)
for a in (entry.mmproj, entry.draft, entry.mtp_head) if a is not None]
return plan
diff --git a/tests/hermes_cli/test_local_mtp_head.py b/tests/hermes_cli/test_local_mtp_head.py
index 58176eee49b..731b2c5616c 100644
--- a/tests/hermes_cli/test_local_mtp_head.py
+++ b/tests/hermes_cli/test_local_mtp_head.py
@@ -1,10 +1,10 @@
"""A model whose MTP head ships as its own file.
-Qwen3.8 Flash Next carries no MTP layers; unsloth publishes the head beside it
-(``MTP/mtp-Qwen3.8-Flash-Next-Q8_0.gguf``) and llama.cpp drafts from it with
-``--spec-type draft-mtp --spec-draft-model <head>``. The head downloads with the model, is priced
-before and after download, and is the only thing that turns MTP on: ``draft-mtp`` without a head
-asks the engine for MTP layers this model does not have.
+Qwen3.8 Flash Next carries no MTP layers. ggml-org publishes a head for it in its own repo
+(``ggml-org/Qwen3.8-Flash-Next-GGUF``, ``mtp-Qwen3.8-Flash-Next-Q8_0.gguf``), and llama.cpp drafts
+from it with ``--spec-type draft-mtp --spec-draft-model <head>``. The head downloads with the model
+from that repo, is priced before and after download, and is the only thing that turns MTP on:
+``draft-mtp`` without a head asks the engine for MTP layers this model does not have.
"""
from __future__ import annotations
@@ -15,6 +15,7 @@ from types import SimpleNamespace
from hermes_cli.local_runtime import bootstrap, catalog, presets
from hermes_cli.local_runtime.catalog import AssetFile, CatalogEntry, QuantVariant
from hermes_cli.local_runtime.estimator import HardwareBudget
+from hermes_cli.web_routers import local_models
GIB = 1 << 30
UNIFIED_128 = HardwareBudget(usable_vram_bytes=int(128 * GIB * 0.8), total_device_bytes=128 * GIB,
@@ -26,35 +27,33 @@ ENTRY = CatalogEntry(
id="head-model", display_name="Head Model", description="", repo="org/Head-Model-GGUF",
variants=(BUILD,), n_ctx_train=262144, full_layers=12, recurrent_layers=36, per_layer_f16=2048,
moe=True, n_vocab=248320, mtp_draft_depth=3,
- mtp_head=AssetFile("MTP/mtp-Head-Model-Q8_0.gguf", 4 * GIB))
+ mtp_head=AssetFile("mtp-Head-Model-Q8_0.gguf", 4 * GIB, repo="other/Head-Model-GGUF"))
-def test_the_head_downloads_with_the_model_and_is_priced_before_download():
+def test_the_head_downloads_with_the_model_from_its_own_repo_and_is_priced_before_download():
without_head = replace(ENTRY, mtp_head=None)
- assert ENTRY.mtp_head in ENTRY.download_files(BUILD)
+ urls = [url for url, _, _ in local_models._download_plan(ENTRY, BUILD)]
+ assert "https://huggingface.co/other/Head-Model-GGUF/resolve/main/mtp-Head-Model-Q8_0.gguf" in urls
+ assert all("/org/Head-Model-GGUF/" in url for url in urls[:2])
assert ENTRY.mtp_capable and not without_head.mtp_capable
with_plan = ENTRY.launch_plan(BUILD, UNIFIED_128)
without_plan = without_head.launch_plan(BUILD, UNIFIED_128)
assert with_plan.overhead_bytes >= without_plan.overhead_bytes + ENTRY.mtp_head.size_bytes
-def _preset(tmp_path, monkeypatch):
+def test_the_preset_drafts_from_the_head_once_it_is_on_disk(tmp_path, monkeypatch):
gguf = tmp_path / "Head-Model-00001-of-00002.gguf"
monkeypatch.setattr(catalog, "entry_for_model",
lambda model_id: ENTRY if model_id == BUILD.model_id else None)
monkeypatch.setattr(presets, "read_gguf_header", lambda p: SimpleNamespace(sampling_defaults={}))
monkeypatch.setattr(presets, "profile_from_gguf", lambda h: ENTRY.profile(BUILD))
- return presets.preset_for_model(gguf, UNIFIED_128, set())
-
-
-def test_the_preset_drafts_from_the_head_once_it_is_on_disk(tmp_path, monkeypatch):
head = bootstrap.assets_dir() / ENTRY.mtp_head.local_name
- before = _preset(tmp_path, monkeypatch)
+ before = presets.preset_for_model(gguf, UNIFIED_128, set())
head.parent.mkdir(parents=True, exist_ok=True)
head.touch()
- after = _preset(tmp_path, monkeypatch)
+ after = presets.preset_for_model(gguf, UNIFIED_128, set())
assert "spec-type" not in before.keys and "model-draft" not in before.keys
assert after.keys["model-draft"] == str(head)