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++
strata_pack build --force; setup passes it when it rebuilds a pack (#634)
Niko12214f4c923cb251
diff --git a/setup.py b/setup.pyindex 13e6fcfc3..def43b723 100644--- a/setup.py+++ b/setup.py@@ -4214,7 +4214,7 @@ def main() -> int:if not (pack / "index.txt").exists() or not (pack / "experts.bin").exists(): # index.txt is written lastsay(" Converting the Q2_0 experts for the AVX-512 kernel (one time, ~40 GB written, 2-5 min) ...")run([sys.executable, str(ROOT / "tools" / "strata_pack.py"), "build", "--gguf", str(shards[0]),- "--out", str(pack), "--skip-hash"], env=env)+ "--out", str(pack), "--skip-hash", "--force"], env=env) # --force: #634 refuses an occupied packrun([sys.executable, str(ROOT / "tools" / "pack_index.py"), "--pack", str(pack)], env=env)if not (pack / "tokenizer" / "vocab.json").exists():run([sys.executable, str(ROOT / "tools" / "strata_tokenizer.py"), "--gguf", str(shards[0]),diff --git a/tools/strata_pack.py b/tools/strata_pack.pyindex ec8aa4547..985d93db9 100644--- a/tools/strata_pack.py+++ b/tools/strata_pack.py@@ -217,13 +217,13 @@ def occupied(out_dir: pathlib.Path) -> pathlib.Path | None:return None-def build(gguf: pathlib.Path, out_dir: pathlib.Path, n_layers: int | None, skip_hash: bool) -> int:+def build(gguf: pathlib.Path, out_dir: pathlib.Path, n_layers: int | None, skip_hash: bool, force: bool = False) -> int:# refused before anything is opened or written: build used to mkdir(exist_ok=True) and overwrite experts.bin,# dense.bin, embd.bin and manifest.json of whatever pack was there, with nothing said- marker = occupied(out_dir)+ marker = None if force else occupied(out_dir) # --force: setup rebuilding a pack that lost index.txt or experts.binif marker is not None:- print("%s already holds a pack (%s is there) - refusing to build; delete the directory or pass another "- "--out" % (out_dir, marker.name))+ print("%s already holds a pack (%s is there) - refusing to build; delete the directory, pass another "+ "--out, or --force to rebuild it" % (out_dir, marker.name))return 1out_dir.mkdir(parents=True, exist_ok=True)g = G.GGUFFile(gguf)@@ -423,6 +423,7 @@ def main() -> int:b.add_argument("--out", required=True)b.add_argument("--layers", type=int, default=None, help="expert layers to emit (default 48)")b.add_argument("--skip-hash", action="store_true")+ b.add_argument("--force", action="store_true", help="build into a directory that already holds a pack (#634)")v = sub.add_parser("verify")v.add_argument("--gguf", required=True)v.add_argument("--out", required=True)@@ -434,7 +435,7 @@ def main() -> int:n.add_argument("--out", required=True)args = ap.parse_args()if args.cmd == "build":- return build(pathlib.Path(args.gguf), pathlib.Path(args.out), args.layers, args.skip_hash)+ return build(pathlib.Path(args.gguf), pathlib.Path(args.out), args.layers, args.skip_hash, args.force)if args.cmd == "verify":return verify(pathlib.Path(args.gguf), pathlib.Path(args.out), args.limit, args.expert_every)return info(pathlib.Path(args.out))diff --git a/tools/test_shards.py b/tools/test_shards.pyindex afe592c99..2afe2dc5c 100644--- a/tools/test_shards.py+++ b/tools/test_shards.py@@ -160,6 +160,15 @@ class PackBuildOccupied(unittest.TestCase):self.run_build(out)self.assertTrue(out.is_dir())+ def test_force_builds_into_an_occupied_dir(self):+ # #634: setup rebuilds a pack that lost its index.txt or experts.bin with --force+ out = self.dir / "forced"+ out.mkdir()+ (out / "manifest.json").write_text("the pack that was there", encoding="utf-8")+ buf = io.StringIO()+ with contextlib.redirect_stdout(buf), self.assertRaises(Stop):+ strata_pack.build(self.dir / "m-00001-of-00002.gguf", out, None, True, True)+def test_unfinished_build_is_rebuilt(self):# experts.bin without manifest.json is a build that stopped before its last file: not a pack, rebuilt as beforeout = self.dir / "unfinished"