feather-a10g-gt80k-runtime-public / scripts /bootstrap_7day_production.py
icarus112's picture
add 7-day production bootstrap (retina + train)
b7263e2 verified
#!/usr/bin/env python3
"""Feather 7-day production bootstrap: retina + train."""
import os, sys, subprocess, time
from pathlib import Path
CACHE_ROOT = Path.home() / '.cache' / 'autoresearch'
FEATHER_ROOT = Path('/workspace/feather')
os.chdir(FEATHER_ROOT)
# ---- retina.npz: synthetic generation ----
retina_path = CACHE_ROOT / 'retina.npz'
if not retina_path.exists():
print('[bootstrap] generating synthetic retina.npz...', flush=True)
import numpy as np
VOCAB = int(os.environ.get('HYDRA_VOCAB', '65536'))
NBITS = int(os.environ.get('HYDRA_SDR_N_BITS', '16384'))
TARG = int(os.environ.get('HYDRA_SDR_TARGET_ACTIVE', '327'))
rng = np.random.default_rng(42)
sdr = np.zeros((VOCAB, NBITS), dtype=bool)
for i in range(VOCAB):
sdr[i, rng.choice(NBITS, size=TARG, replace=False)] = True
retina_path.parent.mkdir(parents=True, exist_ok=True)
np.savez_compressed(str(retina_path), sdr=sdr, vocab_size=VOCAB, n_bits=NBITS, target_active=TARG)
print(f'[bootstrap] retina.npz written ({retina_path.stat().st_size} bytes)', flush=True)
else:
print(f'[bootstrap] retina.npz already cached ({retina_path.stat().st_size} bytes)', flush=True)
# ---- train.py ----
print('[bootstrap] launching train.py...', flush=True)
sys.exit(subprocess.run([sys.executable, '-u', 'train.py']).returncode)