Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

setup: honour HF_ENDPOINT, and say where the model files go (#495)

Niko1221b317c34698b0
diff --git a/docs/INSTALL.md b/docs/INSTALL.md
index ff2d71755..c566c430b 100644
--- a/docs/INSTALL.md
+++ b/docs/INSTALL.md
@@ -192,5 +192,11 @@ START-HERE.bat --calibrate tune the engine for this PC (abo
START-HERE.bat --check only check this PC
```
+**Model files downloaded by hand, or from a mirror (#495):** setup's step 5 prints the folder it expects them in
+(`Strata-data\models\<SIZE>\`, e.g. `Strata-data\models\IQ3_XXS\`): put them there with their original names, or
+point setup at them with `--gguf-dir`. To let setup download from a Hugging Face mirror itself, set `HF_ENDPOINT`
+first (Windows: `set HF_ENDPOINT=https://hf-mirror.com`, Linux: `export HF_ENDPOINT=https://hf-mirror.com`): the same
+pinned revisions and checks apply, and the MTP draft layer comes from there too.
+
On Linux the same options go to `./setup.sh`. `START-HERE.bat --help` lists them all. The server's own settings
(sharing the GPU with games, MCP tools, CORS, API keys, the API itself) are in the [details](DETAILS.md#using-it).
diff --git a/setup.py b/setup.py
index 81bcf050d..0ecfcb5f5 100644
--- a/setup.py
+++ b/setup.py
@@ -69,14 +69,23 @@ HF_REVISIONS = {
}
+HF_DEFAULT = "https://huggingface.co"
+
+
+def hf_endpoint() -> str:
+ """#495: the Hugging Face host - HF_ENDPOINT as huggingface_hub reads it (a mirror, e.g. https://hf-mirror.com),
+ else huggingface.co. The pinned revisions and the SHA-256 checks are the same whichever host serves the files."""
+ return (os.environ.get("HF_ENDPOINT") or "").strip().rstrip("/") or HF_DEFAULT
+
+
def hf(repo: str) -> str:
"""The download folder of a Hugging Face repository at its pinned revision."""
- return f"https://huggingface.co/{repo}/resolve/{HF_REVISIONS[repo]}/"
+ return f"{hf_endpoint()}/{repo}/resolve/{HF_REVISIONS[repo]}/"
def hf_unpinned(url: str) -> str:
"""The same file at the repository's current revision (main)."""
- return re.sub(r"(https://huggingface\.co/.+?/resolve/)[0-9a-f]{40}/", r"\1main/", url, count=1)
+ return re.sub(r"^(https?://[^/]+/.+?/resolve/)[0-9a-f]{40}/", r"\1main/", url, count=1)
HF = hf("ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF")
@@ -3261,6 +3270,13 @@ def main() -> int:
# ---- 5. the model files
step(5, f"downloading {fam['title']} {model}")
if not a.gguf_dir:
+ missing = [s.name for s in shards if not (s.exists() and done(s))]
+ if missing: # #495: files downloaded by hand go here, or --gguf-dir
+ say(f" The model files go in {models_dir}")
+ say(f" Files you already have: put them here with their original names ({', '.join(missing)}), or use "
+ "--gguf-dir <their folder>.")
+ if hf_endpoint() != HF_DEFAULT:
+ say(f" Downloading from {hf_endpoint()} (HF_ENDPOINT)")
for s in shards:
if s.exists() and done(s):
ok(f"{s.name} already downloaded")
diff --git a/tools/mtp_fetch.py b/tools/mtp_fetch.py
index 1893e607e..eb1b7ce61 100644
--- a/tools/mtp_fetch.py
+++ b/tools/mtp_fetch.py
@@ -31,8 +31,10 @@ import urllib.request
# repository no longer has it, the current files are read instead, with a message (resolve_repo).
PINNED_REVISION = "de4b8e4d43b917e7706784d8bb445c9af86a3540"
REVISION = os.environ.get("STRATA_MTP_REVISION") or PINNED_REVISION
-REPO = "https://huggingface.co/Qwen/Qwen3.8-Flash-Next/resolve/%s/" % REVISION
-PINNED = "https://huggingface.co/Qwen/Qwen3.8-Flash-Next/resolve/%s/" % PINNED_REVISION # SHA256's revision
+# #495: HF_ENDPOINT (a mirror, e.g. https://hf-mirror.com) serves the same revision; the SHA256 checks below still apply
+HF_ENDPOINT = (os.environ.get("HF_ENDPOINT") or "").strip().rstrip("/") or "https://huggingface.co"
+REPO = HF_ENDPOINT + "/Qwen/Qwen3.8-Flash-Next/resolve/%s/" % REVISION
+PINNED = HF_ENDPOINT + "/Qwen/Qwen3.8-Flash-Next/resolve/%s/" % PINNED_REVISION # SHA256's revision
DTYPE_BYTES = {"BF16": 2, "F16": 2, "F32": 4, "F8_E4M3": 1, "I64": 8, "I32": 4}
BAD = 3 # `verify`'s exit code: a tensor is missing or corrupt
diff --git a/tools/test_setup_pins.py b/tools/test_setup_pins.py
index 4cfe3931f..c600f6927 100644
--- a/tools/test_setup_pins.py
+++ b/tools/test_setup_pins.py
@@ -98,6 +98,48 @@ class HuggingFacePins(unittest.TestCase):
finally:
mtp_fetch.REPO = pinned
+ def test_hf_endpoint(self):
+ # #495: HF_ENDPOINT (a mirror) serves the same pinned revision; a trailing slash and blanks are dropped
+ repo = "ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF"
+ with mock.patch.dict(setup.os.environ, {}, clear=False):
+ setup.os.environ.pop("HF_ENDPOINT", None)
+ self.assertEqual(setup.hf(repo), f"https://huggingface.co/{repo}/resolve/{setup.HF_REVISIONS[repo]}/")
+ for value in ("https://hf-mirror.com", "https://hf-mirror.com/", " https://hf-mirror.com/ "):
+ setup.os.environ["HF_ENDPOINT"] = value
+ url = setup.hf(repo)
+ self.assertEqual(url, f"https://hf-mirror.com/{repo}/resolve/{setup.HF_REVISIONS[repo]}/")
+ self.assertRegex(url, SHA)
+ self.assertEqual(setup.hf_unpinned(url + "x.gguf"), f"https://hf-mirror.com/{repo}/resolve/main/x.gguf")
+ setup.os.environ["HF_ENDPOINT"] = ""
+ self.assertEqual(setup.hf_endpoint(), "https://huggingface.co")
+
+ def test_mtp_fetch_honours_hf_endpoint(self):
+ import importlib
+ import mtp_fetch
+ try:
+ with mock.patch.dict(mtp_fetch.os.environ, {"HF_ENDPOINT": "https://hf-mirror.com/"}):
+ importlib.reload(mtp_fetch)
+ self.assertTrue(mtp_fetch.REPO.startswith("https://hf-mirror.com/Qwen/Qwen3.8-Flash-Next/resolve/"))
+ self.assertRegex(mtp_fetch.REPO, SHA)
+ self.assertTrue(mtp_fetch.pinned()) # the tensors' SHA-256 checks still apply
+ finally:
+ importlib.reload(mtp_fetch)
+ self.assertTrue(mtp_fetch.REPO.startswith("https://huggingface.co/"))
+
+ def test_step5_names_the_folder(self):
+ # #495: where setup expects the model files, and how to give it files downloaded by hand
+ from test_setup_golden import PROFILES, install
+ ram, found = PROFILES["96GB-1x16GB"]
+ with mock.patch.dict(setup.os.environ, {"HF_ENDPOINT": "https://hf-mirror.com"}):
+ code, out, cfg, _ = install(ram, found, ["--family", "qwen", "--model", "IQ3_XXS", "--no-start"])
+ self.assertEqual(code, 0)
+ text = out.replace("\\", "/")
+ self.assertRegex(text, r"The model files go in .*/models/IQ3_XXS")
+ self.assertIn("put them here with their original names (Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf",
+ text)
+ self.assertIn("--gguf-dir", text)
+ self.assertIn("Downloading from https://hf-mirror.com (HF_ENDPOINT)", text)
+
class Engine(unittest.TestCase):
def setUp(self):