Upload scripts/v26_pq/publish/make_charts.py with huggingface_hub
Browse files
scripts/v26_pq/publish/make_charts.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Generate charts for the v26 HF model card."""
|
| 3 |
+
import json
|
| 4 |
+
import sys
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
import matplotlib
|
| 8 |
+
matplotlib.use("Agg")
|
| 9 |
+
import matplotlib.pyplot as plt
|
| 10 |
+
|
| 11 |
+
HERE = Path("/home/jaime/lut_work/dna-2b-tests/v26_pq/publish")
|
| 12 |
+
OUT = HERE / "charts"
|
| 13 |
+
OUT.mkdir(parents=True, exist_ok=True)
|
| 14 |
+
REPORT = "/home/jaime/lut_work/dna-2b-tests/v25_eval/results/report.json"
|
| 15 |
+
GATE_V26 = "/home/jaime/lut_work/dna-2b-tests/v26_pq/results/gate_v26.json"
|
| 16 |
+
GATE_V25 = "/home/jaime/lut_work/dna-2b-tests/v26_pq/results/gate_g8b12.json"
|
| 17 |
+
|
| 18 |
+
BLUE = "#2b6cb0"
|
| 19 |
+
RED = "#c53030"
|
| 20 |
+
GREEN = "#2f855a"
|
| 21 |
+
GRAY = "#718096"
|
| 22 |
+
|
| 23 |
+
# 1) Training throughput (v25 base, same arch as v26)
|
| 24 |
+
r = json.load(open(REPORT))
|
| 25 |
+
series = [s for s in r["training"]["series"] if "v25-base" in s.get("source", "")]
|
| 26 |
+
steps = [s["step"] for s in series]
|
| 27 |
+
tps = [s["tokens_per_second"] for s in series]
|
| 28 |
+
fig, ax = plt.subplots(figsize=(8, 4.5), dpi=130)
|
| 29 |
+
ax.plot(steps, tps, color=BLUE, lw=1.4)
|
| 30 |
+
ax.axhline(r["training"]["mean_tokens_per_second"], color=GREEN, ls="--", lw=1,
|
| 31 |
+
label=f"mean {r['training']['mean_tokens_per_second']:.0f} tok/s")
|
| 32 |
+
ax.set_xlabel("step")
|
| 33 |
+
ax.set_ylabel("tokens/s")
|
| 34 |
+
ax.set_title("v25/v26 base pretraining throughput (same arch)")
|
| 35 |
+
ax.legend()
|
| 36 |
+
ax.grid(alpha=0.25)
|
| 37 |
+
fig.tight_layout(); fig.savefig(OUT / "training_tok_s.png"); plt.close(fig)
|
| 38 |
+
|
| 39 |
+
# 2) Compression CE delta: v25 ternary vs v26 all-fp16 vs v26 mixed
|
| 40 |
+
g25 = json.load(open(GATE_V25))
|
| 41 |
+
g26 = json.load(open(GATE_V26))
|
| 42 |
+
labels = ["v25 ternary\n(+4.95)", "v26 all-fp16\n(+0.026)", "v26 mixed\n(-0.028)"]
|
| 43 |
+
deltas = [4.952, 0.0255, -0.0276]
|
| 44 |
+
colors = [RED, GRAY, GREEN]
|
| 45 |
+
fig, ax = plt.subplots(figsize=(7, 4.5), dpi=130)
|
| 46 |
+
bars = ax.bar(labels, deltas, color=colors)
|
| 47 |
+
ax.axhline(0.01, color=RED, ls="--", lw=1, label="quality gate +0.01")
|
| 48 |
+
ax.axhline(0, color="black", lw=0.8)
|
| 49 |
+
for b, d in zip(bars, deltas):
|
| 50 |
+
ax.text(b.get_x() + b.get_width() / 2, b.get_height() + (0.12 if d >= 0 else -0.35),
|
| 51 |
+
f"{d:+.3f}", ha="center", fontsize=11, fontweight="bold")
|
| 52 |
+
ax.set_ylabel("compression validation CE delta")
|
| 53 |
+
ax.set_title("Compression quality: v25 vs v26 codecs")
|
| 54 |
+
ax.legend()
|
| 55 |
+
ax.grid(axis="y", alpha=0.25)
|
| 56 |
+
fig.tight_layout(); fig.savefig(OUT / "compression_ce_delta.png"); plt.close(fig)
|
| 57 |
+
|
| 58 |
+
# 3) Size comparison
|
| 59 |
+
labels = ["v25 ternary\n186.6 MiB", "v26 all-fp16\n166.6 MiB", "v26 mixed\n176.6 MiB", "195 MiB cap"]
|
| 60 |
+
sizes = [186.6, 166.6, 176.6, 195.0]
|
| 61 |
+
colors = [RED, GRAY, GREEN, "#00000022"]
|
| 62 |
+
fig, ax = plt.subplots(figsize=(7, 4.5), dpi=130)
|
| 63 |
+
bars = ax.bar(labels, sizes, color=colors)
|
| 64 |
+
for b, s in zip(bars, sizes):
|
| 65 |
+
ax.text(b.get_x() + b.get_width() / 2, s + 2, f"{s:.1f}", ha="center", fontsize=11, fontweight="bold")
|
| 66 |
+
ax.set_ylabel("MiB")
|
| 67 |
+
ax.set_title("Deployment checkpoint size (2B logical params)")
|
| 68 |
+
ax.grid(axis="y", alpha=0.25)
|
| 69 |
+
fig.tight_layout(); fig.savefig(OUT / "checkpoint_size.png"); plt.close(fig)
|
| 70 |
+
|
| 71 |
+
# 4) HumanEval comparison vs peers (web-sourced, brave searches logged)
|
| 72 |
+
models = ["Qwen2.5-Coder\n1.5B", "SmolLM2\n1.7B", "Gemma-2\n2B", "TinyLlama\n1.1B",
|
| 73 |
+
"Phi-2\n2.7B", "DNA-DiskChat\n2B PEER v26"]
|
| 74 |
+
he = [43.3, 28.1, 17.7, 8.5, 59.2, 0.0]
|
| 75 |
+
mbpp = [50.0, None, None, 12.3, 59.1, 0.0]
|
| 76 |
+
fig, ax = plt.subplots(figsize=(8.5, 4.8), dpi=130)
|
| 77 |
+
x = range(len(models))
|
| 78 |
+
b1 = ax.bar([i - 0.2 for i in x], he, width=0.4, color=BLUE, label="HumanEval pass@1")
|
| 79 |
+
for i, v in enumerate(he):
|
| 80 |
+
ax.text(i - 0.2, v + 1.2, f"{v:.1f}", ha="center", fontsize=9)
|
| 81 |
+
for i, v in enumerate(mbpp):
|
| 82 |
+
if v is not None:
|
| 83 |
+
ax.bar(i + 0.2, v, width=0.4, color=GREEN, label="MBPP pass@1" if i == 0 else None)
|
| 84 |
+
ax.text(i + 0.2, v + 1.2, f"{v:.1f}", ha="center", fontsize=9)
|
| 85 |
+
ax.axhline(0, color="black", lw=0.8)
|
| 86 |
+
ax.set_xticks(list(x)); ax.set_xticklabels(models, fontsize=9)
|
| 87 |
+
ax.set_ylabel("pass@1 (%)")
|
| 88 |
+
ax.set_title("HumanEval / MBPP: DNA-DiskChat-2B-PEER-v26 vs same-size peers")
|
| 89 |
+
ax.legend()
|
| 90 |
+
ax.grid(axis="y", alpha=0.25)
|
| 91 |
+
ax.annotate("v26: 0% — honest result, see README", xy=(7, 0.5), fontsize=10, color=RED, ha="right")
|
| 92 |
+
fig.tight_layout(); fig.savefig(OUT / "benchmark_comparison.png"); plt.close(fig)
|
| 93 |
+
|
| 94 |
+
print("charts written:", sorted(p.name for p in OUT.iterdir()))
|