diff --git a/setup.py b/setup.py index 0f888be0..f2db8492 100644 --- a/setup.py +++ b/setup.py @@ -256,8 +256,47 @@ NVFP4_REPOS = { "qwen-nvidia-nvfp4-dense.gguf": ("dense", 5992176896, "0f795ca0cbb908e0cf2b894b30103e21455b5a05346a7ef79da208540cfd2be3"), **_NVFP4_SHARED}}, } +NVFP4_FP4LOCAL_REPO = "nvidia/Qwen3.8-Flash-Next-FP4-Local" # NVIDIA's QAD checkpoint (ModelOpt safetensors), prepared here +# Not a ready-made pack: the safetensors (95 GiB) are downloaded as NVIDIA ships them and tools/nvfp4_local_pack.py prepare +# turns them into the pack, the dense GGUF, the n-gram table and the draft layer on this PC (nothing of NVIDIA's weights is +# redistributed). Role "src" = a file of the checkpoint; the prepared files are in FP4LOCAL_PREPARED. +NVFP4_REPOS[NVFP4_FP4LOCAL_REPO] = {"revision": "b9ce18a6887e18c089fdea8509a33e63429a3300", "files": { + "config.json": ("src", 75217, "b50dbc52a0c83b0cd2a44a372c1fb6b5e0e6827d22f2611c97d4d030f92f6b28"), + "generation_config.json": ("src", 202, "e70c136c1b78ddc1fb0905bac8e733a4dc448d4f852a5dd75143fffc70be550e"), + "chat_template.jinja": ("src", 8952, "c3cf9e34abf4f9e36c2d72165aa9c132d3e2a725b6c2586aaa3a8af9d7a81041"), + "merges.txt": ("src", 3353259, "a9d356d7bdf1ef4949e3e748e95b8e10ad9d4e2e838eddc38a0a7b6b94d1db8d"), + "tokenizer.json": ("src", 12809320, "0997f410c57a1f4e53b09e4be8f4a172d90edd9564368fb0847030937229b9f3"), + "tokenizer_config.json": ("src", 17928, "b11349aafa7cdc6a320767cf7ceb29ed82f7eda5d65e8e0819e76f0ce947bf27"), + "vocab.json": ("src", 6722759, "ce99b4cb2983d118806ce0a8b777a35b093e2000a503ebde25853284c9dfa003"), + "model.safetensors.index.json": ("src", 47280974, "5fa166bbb1cf25adda455117563efa72a2072272001f459eedece131ffc913e1"), + "tensors/model-00001-of-00021.safetensors": ("src", 5000643504, "ebf3648c5f4cd1f24e79789e7803498dc4e74cb52515cc515b2d22cf8161953b"), + "tensors/model-00002-of-00021.safetensors": ("src", 5002792096, "79a643fc5c024089cecd32ca27dc43e671cbec70ff3628b728909b7656ac43ec"), + "tensors/model-00003-of-00021.safetensors": ("src", 5002927400, "c45f942203db4c7f5a1071700b93b908495cc790271acddfff39091c2b953923"), + "tensors/model-00004-of-00021.safetensors": ("src", 5003194672, "071ab9cf963ca0f1a6a194b4cec485f5de18ef9804da915b2e6abd0eb0c707af"), + "tensors/model-00005-of-00021.safetensors": ("src", 5003151448, "f80d17870eb1d36917257494770984953476583c57737f61fdbd341c957b9715"), + "tensors/model-00006-of-00021.safetensors": ("src", 5002892148, "3e9183d4ebb267fa92429184d5132d302cb1a98fd049149e5d01dccd4ca65795"), + "tensors/model-00007-of-00021.safetensors": ("src", 5002907708, "aa1ad959c4d62e0bc4600fd0b57cc2939b463e9fb53dc01020e188552b52ce5a"), + "tensors/model-00008-of-00021.safetensors": ("src", 5003103756, "0b18844027be74b84b240f23bf3a744bc29b35de0bd384f41c40cd85e6339326"), + "tensors/model-00009-of-00021.safetensors": ("src", 5002976316, "2d0b6c66790c17f8b1fdcf442f541778c8f0a381aca26c11b9d7cfcf7c96f2f0"), + "tensors/model-00010-of-00021.safetensors": ("src", 5002834136, "3ed9bd73745aebf6dc136f437b67d6b9fc3d38d25ad84300b399164bc87a72b7"), + "tensors/model-00011-of-00021.safetensors": ("src", 5002685828, "4936ff28c6cc8b66653ddb9cae28bc284569a1a2f7116819a017dc1a0e517ed8"), + "tensors/model-00012-of-00021.safetensors": ("src", 5002912920, "dd7df5a6ff73e9960412243f744eab9ec35f4be40da5bb158dc4ba8796b33742"), + "tensors/model-00013-of-00021.safetensors": ("src", 5003237060, "28a455c8ea4ebaa847fb4cbed2bc1de9eff0b501dd3f848a3a3cfc38778e8500"), + "tensors/model-00014-of-00021.safetensors": ("src", 4845006312, "6941676e685abf9817d9c48a17fdeda20b2b72d16217555252aa4c602b7f98b8"), + "tensors/model-00015-of-00021.safetensors": ("src", 4860574920, "2a1129b5acfc24a45bf402aa63dcef08b531aedfdaf5233c65fd3d12dc303fdd"), + "tensors/model-00016-of-00021.safetensors": ("src", 4950031028, "635e97fbad78fa988647d407e2b58e55d551ef94d798c9b6fb5550de25e86429"), + "tensors/model-00017-of-00021.safetensors": ("src", 4950030896, "bf60d564d89a805b67f8be5f2847a1b1567a70dbc23d19754395c127568474ad"), + "tensors/model-00018-of-00021.safetensors": ("src", 4950030896, "c5bde22f9364e82eb25973456795592fdcb4b158bc2095898979a2566bf4c562"), + "tensors/model-00019-of-00021.safetensors": ("src", 4950030904, "da3dc3b4f428f5b9dd53362691043d0242f48d03adca9b7b553bd9f3a1e96350"), + "tensors/model-00020-of-00021.safetensors": ("src", 4950030904, "4978bb6b8480cfc02d3c8bc84ba86202889f5f10d090bb17c21fee663cea7683"), + "tensors/model-00021-of-00021.safetensors": ("src", 2700016864, "48203838f2c76921bddbf1cc51d20a23858c128821a21add55fa1778e5e25283"), +}} +FP4LOCAL_PREPARED = "prepared" # /nvidia--Qwen3.8-Flash-Next-FP4-Local/prepared/ + # the first release engine with NVFP4 experts (a source build of this checkout has them whatever its number says) NVFP4_ENGINE = (0, 1, 44) +# the first engine that reads NVIDIA's NVFP4 n-gram table (strata.ple.format = nvfp4x16); a source build of this checkout has it +FP4LOCAL_ENGINE = (0, 1, 46) # agentionai's Gyro files (Qwen3.8-Flash-Next with trellis-coded, Hadamard-rotated experts, TQ2_T / TQK6 / TQK7): one # GGUF per size, the n-gram table inside it (hence the 58 / 92 GB downloads for 27.6 / 35 GB of memory). The engine @@ -348,6 +387,15 @@ MODELS = { "license": "NVIDIA Open Model License (Licensed by NVIDIA Corporation under the NVIDIA Open Model " "License) with Qwen3.8-Flash-Next's Qwen Community License 1.0: " "https://huggingface.co/nvidia/Qwen3.8-Flash-Next-NVFP4"}, + "NVFP4-QAD": {"about": "NVIDIA's own retrained 4-bit model (quantization-aware distillation, NVIDIA's Qwen3.8-Flash-Next-FP4-Local): " + "a 102 GB download that this PC turns into a Strata pack (about 20-40 minutes and 110 GB more disk, " + "once); RTX 50 cards have FP4 tensor cores, other NVIDIA cards run it at 8-bit precision. No images yet", + "download_gb": 102.2, "prepare_gb": 110.0, "ram_gb": 80, "arena_gb": 68.0, + "families": ("nvfp4",), "nvidia_only": True, "vision": False, "repo": NVFP4_FP4LOCAL_REPO, + "prepare": "fp4-local", "engine": FP4LOCAL_ENGINE, + "license": "NVIDIA Open Model Agreement (Licensed by NVIDIA Corporation under the NVIDIA Open Model " + "Agreement) with Qwen3.8-Flash-Next's Qwen Community License 1.0: " + "https://huggingface.co/nvidia/Qwen3.8-Flash-Next-FP4-Local"}, } # The experimental Unsloth file's four shards at the pinned revision: name -> (bytes, sha256), checked after the # download (setup trusts no other model file by name and size alone either: check_shards reads their directories). @@ -1904,8 +1952,23 @@ def ready_where(models_dir: Path, f) -> Path: return Path(models_dir) / f[1].replace("/", "--") / f[3] +def prepared_dir(model: str, models_dir: Path) -> Path: + """Where a model that is prepared on this PC (MODELS[..]["prepare"]) keeps what it prepared.""" + return Path(models_dir) / MODELS[model]["repo"].replace("/", "--") / FP4LOCAL_PREPARED + + +def prepared_done(model: str, models_dir: Path) -> bool: + """The last file tools/nvfp4_local_pack.py prepare writes is there (the draft layer's experts).""" + return (prepared_dir(model, models_dir) / "mtp" / "rt" / "experts.bin").is_file() and \ + (prepared_dir(model, models_dir) / "pack" / "native_experts.txt").is_file() + + def ready_paths(model: str, models_dir: Path) -> dict: - """What the engine is given: the pack folder and the dense, PLE and embedding GGUFs.""" + """What the engine is given: the pack folder and the dense, PLE and embedding GGUFs (a prepared model also has its + own draft layer, "mtp", and no separate embedding: the token embedding is in its dense GGUF).""" + if MODELS[model].get("prepare"): + d = prepared_dir(model, models_dir) + return {"pack": d / "pack", "dense": d / "dense.gguf", "ple": d / "ple-nvfp4.gguf", "mtp": d / "mtp"} out = {} for f in ready_files(model): p = ready_where(models_dir, f) @@ -6858,7 +6921,9 @@ def main() -> int: pack_bin = ready or ((pack_now / "experts.bin").exists() and (pack_now / "index.txt").exists()) # ready: in the download mtp_have = find_in(roots, "mtp/rt/experts.bin") is not None q2_avx = model == "Q2_0" and avx512 and family == "qwen" - need = to_fetch + (2 if mtp_have else 8) + \ + prep_gb = MODELS[model].get("prepare_gb", 0.0) if ready and MODELS[model].get("prepare") and \ + not prepared_done(model, models_dir) else 0.0 + need = to_fetch + prep_gb + (2 if mtp_have else 8) + \ (40 if q2_avx and not pack_bin else 0) + (1 if vision != "none" else 0) + \ (MODELS[model]["arena_gb"] + 1 if low_ram and not q2_avx and not pack_bin else 0) if free_gb(models_dir) < need: @@ -6950,6 +7015,15 @@ def main() -> int: step(6, "preparing the model for Strata") pack = find_in(roots, f"packs/{tag.lower()}") or data / "packs" / tag.lower() env = dict(os.environ, STRATA_GGUF_PY=str(llama / "gguf-py")) + prepared = bool(ready and MODELS[model].get("prepare")) + if prepared and not prepared_done(model, models_dir): + say(" NVIDIA's checkpoint is turned into a Strata pack on this PC (once; 20-40 minutes, reads the 102 GB, writes about") + say(f" {MODELS[model]['prepare_gb']:.0f} GB). Nothing of NVIDIA's weights leaves this PC.") + run([sys.executable, str(ROOT / "tools" / "nvfp4_local_pack.py"), "prepare", + "--model", str(ready_where(models_dir, ("src", MODELS[model]["repo"], "", "", 0, ""))), + "--out", str(prepared_dir(model, models_dir))], env=env) + ok("prepared; the downloaded checkpoint is no longer needed and can be deleted to get its 102 GB back: " + + str(ready_where(models_dir, ("src", MODELS[model]["repo"], "", "", 0, "")))) if ready: # the downloaded pack folder is the pack, experts.bin included pack = ready_paths(model, models_dir)["pack"] elif model == "Q2_0" and avx512 and family == "qwen": @@ -6972,9 +7046,10 @@ def main() -> int: run([sys.executable, str(ROOT / "tools" / "iq_pack.py"), "--gguf", str(shards[0]), "--out", str(pack), "--experts-bin"], env=env) ok(f"model prepared: {pack}") - mtp = (find_in(roots, "mtp/rt/experts.bin") or data / "mtp/rt/experts.bin").parent.parent + mtp = ready_paths(model, models_dir)["mtp"] if prepared else \ + (find_in(roots, "mtp/rt/experts.bin") or data / "mtp/rt/experts.bin").parent.parent rt = mtp / "rt" - corrupt = (rt / "experts.bin").exists() and mtp_corrupt(mtp, env) + corrupt = (rt / "experts.bin").exists() and not prepared and mtp_corrupt(mtp, env) if corrupt: warn("some MTP tensors are not the checkpoint's (a download mirror that ignored range requests, #327): " "fetching them again and rebuilding the draft layer") @@ -7002,7 +7077,7 @@ def main() -> int: rp = ready_paths(model, models_dir) # the FP8 n-gram table, the BF16 token embedding ple = rp["ple"] model_args = ["--pack", str(pack), "--native", str(rp["dense"]), "--native-dense-gguf", str(rp["dense"]), - "--ple-gguf", str(ple), "--embd-gguf", str(rp["embd"])] + "--ple-gguf", str(ple), *(["--embd-gguf", str(rp["embd"])] if "embd" in rp else [])] else: ple = next((s for s in shards if any(t.name == "per_layer_token_embd.weight" for t in GGUFFile(s).tensors)), None) if ple is None: diff --git a/tools/nvfp4_local_pack.py b/tools/nvfp4_local_pack.py index 72966a70..9bc661de 100644 --- a/tools/nvfp4_local_pack.py +++ b/tools/nvfp4_local_pack.py @@ -540,6 +540,54 @@ def cmd_pack(a) -> int: return iq_pack.main() +# ------------------------------------------------------------------------------------------------------- prepare (setup) +def cmd_prepare(a) -> int: + """Everything setup needs from the downloaded checkpoint, each step skipped when its mark is there: + /ple-nvfp4.gguf the n-gram table /dense.gguf the dense weights (no experts) + /pack/ index.txt, dense.bin, experts.bin, native_experts.txt, tokenizer/ + /mtp/rt/ the draft layer (a Q2_0 copy of NVIDIA's MTP experts) + The checkpoint is read, never changed; it can be deleted afterwards (the pack and the two GGUFs hold everything).""" + import subprocess + model, out = pathlib.Path(a.model), pathlib.Path(a.out) + out.mkdir(parents=True, exist_ok=True) + me = [sys.executable, str(pathlib.Path(__file__).resolve())] + tools = pathlib.Path(__file__).resolve().parent + + def run(cmd): + r = subprocess.run(cmd) + if r.returncode: + sys.exit("prepare: %s failed (exit %d)" % (cmd[1] if len(cmd) > 1 else cmd[0], r.returncode)) + + def step(name, mark, fn): + if mark.exists(): + print("prepare: %s already done" % name, flush=True) + return + print("prepare: %s ..." % name, flush=True) + t0 = time.time() + fn() + mark.write_text("done %.0f s\n" % (time.time() - t0)) + + step("the n-gram table", out / "ple-nvfp4.gguf.done", + lambda: run(me + ["ple", "--model", str(model), "--out", str(out / "ple-nvfp4.gguf")])) + step("the dense weights", out / "dense.gguf.done", + lambda: run(me + ["convert", "--dense-only", "--model", str(model), "--outfile", str(out / "dense.gguf")])) + step("the experts and the pack", out / "pack" / "native_experts.txt", + lambda: run(me + ["pack", "--model", str(model), "--dense-gguf", str(out / "dense.gguf"), "--out", str(out / "pack")])) + + mtp = out / "mtp" + + def draft_layer(): + src = mtp / "src" + run(me + ["mtp", "--model", str(model), "--out", str(src)]) + run([sys.executable, str(tools / "mtp_pack.py"), "--src", str(src), "--experts", "q2_0", + "--out", str(mtp / "mtp-q2_0.gguf")]) + run([sys.executable, str(tools / "mtp_rt.py"), "--gguf", str(mtp / "mtp-q2_0.gguf"), "--out", str(mtp / "rt")]) + import shutil + shutil.rmtree(src, ignore_errors=True) + step("the draft layer", mtp / "rt" / "experts.bin", draft_layer) + print("prepare: done -> %s" % out) + return 0 + # ------------------------------------------------------------------------------------------------------ verifying def cmd_verify(a) -> int: """Experts: decode the checkpoint (CSF + ModelOpt definition) and compare with gguf-py's dequantization of the @@ -593,6 +641,9 @@ def main() -> int: pk.add_argument("--model", required=True) pk.add_argument("--dense-gguf", required=True, help="the output of `convert --dense-only` (or `slim`)") pk.add_argument("--out", required=True) + pr = sub.add_parser("prepare") + pr.add_argument("--model", required=True) + pr.add_argument("--out", required=True) sl = sub.add_parser("slim") sl.add_argument("--gguf", required=True) sl.add_argument("--out", required=True) @@ -601,7 +652,7 @@ def main() -> int: v.add_argument("--gguf", required=True) v.add_argument("--experts", type=int, default=4) a = ap.parse_args() - return {"convert": cmd_convert, "ple": cmd_ple, "mtp": cmd_mtp, "slim": cmd_slim, "pack": cmd_pack, "verify": cmd_verify}[a.cmd](a) + return {"convert": cmd_convert, "ple": cmd_ple, "mtp": cmd_mtp, "slim": cmd_slim, "pack": cmd_pack, "prepare": cmd_prepare, "verify": cmd_verify}[a.cmd](a) if __name__ == "__main__": diff --git a/tools/strata_mcp.py b/tools/strata_mcp.py index f6a70f33..ae54424b 100644 --- a/tools/strata_mcp.py +++ b/tools/strata_mcp.py @@ -91,6 +91,9 @@ FALLBACK_MODELS = { "NVFP4-NVIDIA": {"about": "NVIDIA's own NVFP4 checkpoint (plain rounding), converted by sergqwer; the same size " "and speed as NVFP4", "download_gb": 128.0, "ram_gb": 80, "arena_gb": 68.0, "families": ("nvfp4",), "vision": True}, + "NVFP4-QAD": {"about": "NVIDIA's own retrained 4-bit model (quantization-aware distillation): a 102 GB download " + "that this PC turns into a Strata pack once; no images yet", + "download_gb": 102.2, "ram_gb": 80, "arena_gb": 68.0, "families": ("nvfp4",), "vision": False}, } FALLBACK_FAMILIES = { "qwen": {"title": "Qwen3.8-Flash-Next", "about": "the original model", "tag": ""}, diff --git a/tools/test_setup_nvfp4.py b/tools/test_setup_nvfp4.py index d4304feb..2e0f3bee 100644 --- a/tools/test_setup_nvfp4.py +++ b/tools/test_setup_nvfp4.py @@ -50,6 +50,7 @@ class ReadyPacks(unittest.TestCase): f.parent.mkdir(parents=True, exist_ok=True) f.write_bytes(body) repos[repo]["files"][path] = (roles[path], len(body), hashlib.sha256(body).hexdigest()) + repos[setup.NVFP4_FP4LOCAL_REPO] = setup.NVFP4_REPOS[setup.NVFP4_FP4LOCAL_REPO] # listed, never fetched here models = {"NVFP4": {**setup.MODELS["NVFP4"], "repo": A}, "NVFP4-NVIDIA": {**setup.MODELS["NVFP4-NVIDIA"], "repo": B}} self.patches = [mock.patch.object(setup, "NVFP4_REPOS", repos), mock.patch.dict(setup.MODELS, models), @@ -100,19 +101,52 @@ class Family(unittest.TestCase): def test_sizes_and_family(self): self.assertTrue(setup.FAMILIES["nvfp4"]["ready"]) names = [m for m in setup.MODELS if "nvfp4" in setup.MODELS[m].get("families", ())] - self.assertEqual(names, ["NVFP4", "NVFP4-NVIDIA"]) # the GPTQ pack first: the default size + self.assertEqual(names, ["NVFP4", "NVFP4-NVIDIA", "NVFP4-QAD"]) # the GPTQ pack first: the default size for m in names: d = setup.MODELS[m] self.assertTrue(d["nvidia_only"]) - self.assertTrue(d["vision"]) - self.assertIn("License", d["license"]) - self.assertEqual(d["engine"], setup.NVFP4_ENGINE) + self.assertEqual(d["vision"], m != "NVFP4-QAD") # the prepared QAD model: text first + self.assertRegex(d["license"], "Licen[sc]e|Agreement") + self.assertEqual(d["engine"], setup.FP4LOCAL_ENGINE if m == "NVFP4-QAD" else setup.NVFP4_ENGINE) def test_gguf_names_skip_the_ready_family(self): self.assertIsNone(setup.gguf_choice("pack-a.gguf")) self.assertEqual(setup.gguf_choice("Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf"), ("qwen", "IQ3_XXS")) +class PreparedModel(unittest.TestCase): + """NVFP4-QAD (NVIDIA's FP4-Local): the checkpoint is downloaded pinned, the pack is prepared on this PC.""" + + def test_the_checkpoint_files_are_pinned(self): + files = setup.ready_files("NVFP4-QAD") + names = {f[3] for f in files} + self.assertEqual(sum(1 for n in names if n.startswith("tensors/model-")), 21) + self.assertTrue({"config.json", "model.safetensors.index.json", "tokenizer.json"} <= names) + self.assertEqual(sum(f[4] for f in files) / 1e9 // 1, setup.MODELS["NVFP4-QAD"]["download_gb"] // 1) + for f in files: + self.assertEqual(f[0], "src") + self.assertRegex(f[5], "^[0-9a-f]{64}$") + self.assertEqual(f[2], "b9ce18a6887e18c089fdea8509a33e63429a3300") + + def test_paths_are_the_prepared_files(self): + m = Path("/models") + p = setup.ready_paths("NVFP4-QAD", m) + d = m / "nvidia--Qwen3.8-Flash-Next-FP4-Local" / "prepared" + self.assertEqual(p, {"pack": d / "pack", "dense": d / "dense.gguf", "ple": d / "ple-nvfp4.gguf", "mtp": d / "mtp"}) + self.assertNotIn("embd", p) + + def test_prepared_done_needs_the_last_files(self): + with tempfile.TemporaryDirectory() as t: + self.assertFalse(setup.prepared_done("NVFP4-QAD", Path(t))) + d = setup.prepared_dir("NVFP4-QAD", Path(t)) + (d / "pack").mkdir(parents=True) + (d / "pack" / "native_experts.txt").write_text("x") + self.assertFalse(setup.prepared_done("NVFP4-QAD", Path(t))) + (d / "mtp" / "rt").mkdir(parents=True) + (d / "mtp" / "rt" / "experts.bin").write_text("x") + self.assertTrue(setup.prepared_done("NVFP4-QAD", Path(t))) + + class MockedInstall(unittest.TestCase): """setup.main() --family nvfp4 --yes on mocked PCs (test_setup_golden's harness): the run config's model flags.""" @@ -156,6 +190,20 @@ class MockedInstall(unittest.TestCase): self.assertIn("NVIDIA-NVFP4-Strata/pack", self.flag(cfg["args"], "--pack")) self.assertIn("NVIDIA Open Model License", out) + def test_qad_size_is_prepared_and_uses_its_own_files(self): + code, out, cfg, _ = self.run_install("128GB-1x24GB", "NVFP4-QAD") + self.assertEqual(code, 0, out[-2500:]) + a = cfg["args"] + base = "nvidia--Qwen3.8-Flash-Next-FP4-Local/prepared" + self.assertTrue(self.flag(a, "--pack").endswith(base + "/pack")) + self.assertTrue(self.flag(a, "--native").endswith(base + "/dense.gguf")) + self.assertEqual(self.flag(a, "--native-dense-gguf"), self.flag(a, "--native")) + self.assertTrue(self.flag(a, "--ple-gguf").endswith(base + "/ple-nvfp4.gguf")) + self.assertNotIn("--embd-gguf", a) # its dense GGUF holds the token embedding + self.assertTrue(self.flag(a, "--mtp").endswith(base + "/mtp/rt")) # NVIDIA's own draft layer, not Qwen's + self.assertIn("NVIDIA Open Model Agreement", out) + self.assertIn("turned into a Strata pack on this PC", out) + def test_96gb_keeps_every_expert_in_ram_64gb_takes_the_ram_budget(self): code, out, cfg, _ = self.run_install("96GB-1x16GB") # 68 GB of experts + 10 GB beside them fit 95.8 self.assertEqual(code, 0, out[-2000:]) diff --git a/tools/test_setup_pins.py b/tools/test_setup_pins.py index 11b19be1..cf82cbd2 100644 --- a/tools/test_setup_pins.py +++ b/tools/test_setup_pins.py @@ -65,8 +65,17 @@ class HuggingFacePins(unittest.TestCase): """NVFP4: every size names a repository of NVFP4_REPOS, pinned by a commit; every file has a size and a SHA-256, and the pack folder, dense GGUF, n-gram table and embedding are each there.""" sizes = [m for m, d in setup.MODELS.items() if d.get("repo")] - self.assertEqual(sorted(sizes), ["NVFP4", "NVFP4-NVIDIA"]) + self.assertEqual(sorted(sizes), ["NVFP4", "NVFP4-NVIDIA", "NVFP4-QAD"]) for m in sizes: + if setup.MODELS[m].get("prepare"): # NVIDIA's checkpoint: pinned files, prepared on the PC + t = setup.NVFP4_REPOS[setup.MODELS[m]["repo"]] + self.assertRegex(t["revision"], r"^[0-9a-f]{40}$") + for path, (role, size, sha) in t["files"].items(): + self.assertEqual(role, "src") + self.assertGreater(size, 0) + self.assertRegex(sha, r"^[0-9a-f]{64}$") + self.assertEqual(sorted(setup.ready_paths(m, setup.Path("M"))), ["dense", "mtp", "pack", "ple"]) + continue t = setup.NVFP4_REPOS[setup.MODELS[m]["repo"]] self.assertRegex(t["revision"], r"^[0-9a-f]{40}$") for path, (role, size, sha) in t["files"].items():