SPIRA v2: entropy-patch tokenization + hierarchical dopamine-gated spiking cortex + hippocampal one-shot memory with replay consolidation
032a961 verified Download python/scripts/bench_vocab.py from thefinalboss/SPIRA: direct link, hf CLI and curl.
- Browser
- Download file 810 Bytes
-
https://huggingface.co/thefinalboss/SPIRA/resolve/main/python/scripts/bench_vocab.py
- Command line
-
hf download hf://thefinalboss/SPIRA/python/scripts/bench_vocab.py
-
curl -L -o bench_vocab.py https://huggingface.co/thefinalboss/SPIRA/resolve/main/python/scripts/bench_vocab.py
810 Bytes
| #!/usr/bin/env python3 | |
| """Benchmark per-tick training cost vs readout vocab size (decides 8k vs 16k).""" | |
| import sys | |
| import time | |
| sys.path.insert(0, "/home/z/my-project/download/spira") | |
| import numpy as np | |
| from spira.spiking import SpikingCore | |
| rng = np.random.default_rng(0) | |
| T = 3000 | |
| for V in (4097, 8193, 16385): | |
| core = SpikingCore(d_in=1024, k_in=12, n_res=512, n_out=V, seed=1) | |
| neurons = rng.integers(0, 1024, size=(T, 12)).astype(np.int32) | |
| cols = rng.integers(0, V - 1, size=T).astype(np.int64) | |
| core.train_pass(neurons[:200], cols[:200]) # warm-up | |
| t0 = time.perf_counter() | |
| core.train_pass(neurons, cols) | |
| dt = time.perf_counter() - t0 | |
| print(f"n_out={V:>6}: {T/dt:7.0f} ticks/s ({dt/T*1000:.2f} ms/tick) " | |
| f"-> 250k ticks = {250_000/(T/dt)/60:.1f} min") | |