DeepSeek plan on AMD: the expert count matches the engine's carve-out (2,365 on one R9700 and 12,152 on four, where real runs held 2,366 and 12,147)

This commit is contained in:
Niko1221 committed 2026-10-31 09:54:21 +01:00
1 parent 86c94204a1
commit 896818a3de
2 files changed
+18 -2

No files matched your search

+9 -2
View File
@@ -87,6 +87,11 @@ ISTA_SETS["UD-IQ1_M"] = {"title": "Unsloth UD-IQ1_M", "set_bytes": 139_809_056_1
"quality": "Unsloth's next dynamic version, the size of ISTA-DAS 2.00 bpw; not measured here yet"}
ISTA_DENSE_GB = 6.16 # the dense weights in the shards (attention, router, shared experts, the head; the embedding stays on the CPU)
ISTA_DENSE_ON_GPU_GB = 4.5 # what a card holds of them with a 12 GB card (measured on the 5070 / 3060: the engine places the rest itself)
# AMD (ROCm) cards keep more beside the experts than the 12 GB NVIDIA cards above: the HIP engine's prompt buffers and graphs. Fitted to the two real
# runs of the 2.25 set (0.2.9 gates, 32 GiB R9700): 1 card holds 2,366 experts, 4 cards 12,147 (the plan said 2,947 and 13,180):
# non-expert memory per card = AMD_RESERVE_GB + AMD_DENSE_ON_GPU_GB / cards (11.4 GB with one card, 4.9 GB with four).
AMD_DENSE_ON_GPU_GB = 8.7
AMD_RESERVE_GB = 2.7
ISTA_MEASURED = ("an RTX 5070 (12 GB) with 64 GB of RAM and a 3.6 GB/s NVMe drive: answers about 4.7 tokens a second, a 4,000-token prompt "
"read at 121 tokens a second; an RTX 3060 (12 GB) with 46 GB of RAM: about 7.2 tokens a second; four Radeon AI PRO R9700 cards: "
"about 31 tokens a second")
@@ -284,8 +289,10 @@ def _plan_ista(model: str, cards: list[dict] | None, ram_gb: float | None, disk_
warns.append("No graphics card Strata can use was found: this model needs one or more cards (8 GB or more; 12 GB is what it was "
"measured with).")
else:
per_dense = ISTA_DENSE_ON_GPU_GB / n
cap = [max(0.0, _cap_gb(float(c.get("vram_gb") or 0)) - per_dense - RESERVE_GB) for c in keep]
amd_cards = all(str(c.get("vendor") or vendor or "").lower() == "amd" for c in keep)
per_dense = (AMD_DENSE_ON_GPU_GB if amd_cards else ISTA_DENSE_ON_GPU_GB) / n
reserve = AMD_RESERVE_GB if amd_cards else RESERVE_GB
cap = [max(0.0, _cap_gb(float(c.get("vram_gb") or 0)) - per_dense - reserve) for c in keep]
vram_exp = min(v["experts_gb"], sum(cap))
ranges = split_layers([float(c.get("vram_gb") or 0) for c in keep])
in_vram = 0
+9
View File
@@ -70,6 +70,15 @@ class UnifiedMemoryPlan(unittest.TestCase):
self.assertEqual(len(p["cards"]), 2)
self.assertTrue(any("Two cards share" in l for l in p["lines"]))
def test_the_amd_plan_matches_what_the_engine_held_on_real_r9700_runs(self):
"""0.2.9 gates (2.25 set, R9700 32 GiB): one card held 2,366 experts, four cards 12,147 (the plan used to say 2,947 and 13,180)."""
from unittest import mock
card = {**R9700[0], "vendor": "amd"}
with mock.patch.object(F, "_on_windows", lambda: False):
for n, real in ((1, 2366), (4, 12147)):
p = F.plan([{**card, "index": i} for i in range(n)], 128.0, 700.0, 8192, vendor="amd", model="IST-DAS-2.25bpw")
self.assertLess(abs(p["experts_in_vram"] - real), 0.005 * real, (n, p["experts_in_vram"]))
def test_the_smaller_set_is_recommended_for_a_small_unified_pc(self):
self.assertEqual(F.recommend(32.0), "IST-DAS-1.75bpw")
self.assertEqual(F.recommend(63.6), "IST-DAS-2.00bpw")