Download scripts/plot_results.py from devildasdf/NEXORA: direct link, hf CLI and curl.
- Browser
- Download file 1.75 kB
-
https://huggingface.co/devildasdf/NEXORA/resolve/main/scripts/plot_results.py
- Command line
-
hf download hf://devildasdf/NEXORA/scripts/plot_results.py
-
curl -L -o plot_results.py https://huggingface.co/devildasdf/NEXORA/resolve/main/scripts/plot_results.py
1.75 kB
| """Static figure from observed training/quantization measurements.""" | |
| from pathlib import Path | |
| import json | |
| import matplotlib | |
| matplotlib.use("Agg") | |
| import matplotlib.pyplot as plt | |
| def main(): | |
| r = json.loads(Path("artifacts/tiny/training-report.json").read_text()) | |
| q = json.loads(Path("reports/quantization.json").read_text()) | |
| plt.rcParams.update({"font.size": 10, "axes.spines.top": False, "axes.spines.right": False}) | |
| fig, axes = plt.subplots(1, 2, figsize=(11, 4.3), layout="constrained") | |
| rows = r["metrics"] | |
| axes[0].plot([x["step"] for x in rows], [x["train_loss"] for x in rows], "o-", label="Training batch", color="#2456a6") | |
| axes[0].plot([x["step"] for x in rows], [x["validation_loss"] for x in rows], "s-", label="Fixed validation batch", color="#c25823") | |
| axes[0].set(xlabel="Optimization step", ylabel="Cross-entropy (nats / byte token)", title="820,736-parameter training experiment") | |
| axes[0].legend(frameon=False) | |
| names = ["fp32", "dynamic_int8_linear_only"] | |
| p50 = [q[n]["batch_latency_seconds"]["p50"]*1000 for n in names] | |
| p95 = [q[n]["batch_latency_seconds"]["p95"]*1000 for n in names] | |
| x = [0, 1] | |
| axes[1].bar([i-.17 for i in x], p50, width=.34, label="P50", color="#2456a6") | |
| axes[1].bar([i+.17 for i in x], p95, width=.34, label="P95", color="#87a5d4") | |
| axes[1].set_xticks(x, ["FP32", "INT8 linear layers"]) | |
| axes[1].set(ylabel="CPU batch latency (ms)", title="20 samples; no clear tail-latency win") | |
| axes[1].legend(frameon=False) | |
| fig.suptitle("NEXORA local prototype: measured mechanics, not capability benchmarks", fontsize=12, fontweight="bold") | |
| fig.savefig("reports/measurements.png", dpi=160) | |
| plt.close(fig) | |
| if __name__ == "__main__": | |
| main() | |