summaryrefslogtreecommitdiff
path: root/scripts/run_grid_search.sbatch
blob: 07e9a7457f80d8f17ba7b017e7e3b7dd605aaafb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
#SBATCH --job-name=snn_grid_search
#SBATCH --account=bfqt-delta-gpu
#SBATCH --partition=gpuA40x4
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=8
#SBATCH --gpus-per-node=1
#SBATCH --mem=32G
#SBATCH --time=48:00:00
#SBATCH --output=runs/slurm_logs/%j_grid_search.out
#SBATCH --error=runs/slurm_logs/%j_grid_search.err

# ============================================================
# Hyperparameter Grid Search for Lyapunov-Regularized SNN
# ============================================================
# Uses CIFAR-10 (real data) with rate encoding
# Includes warmup for λ_reg to avoid killing learning early
#
# Grid:
#   - Depths: 4, 6, 8, 10
#   - λ_reg: 0.01, 0.05, 0.1, 0.2, 0.3
#   - λ_target: 0.0, -0.05, -0.1, -0.2
#
# Total: 4 depths × 5 λ_reg × 4 λ_target = 80 configurations
# Estimated time: ~4 min/config × 80 = ~5-6 hours
# ============================================================

set -e

PROJECT_DIR="/projects/bfqt/users/yurenh2/ml-projects/snn-training"
cd "$PROJECT_DIR"

mkdir -p runs/slurm_logs

echo "============================================================"
echo "Hyperparameter Grid Search"
echo "Job ID: $SLURM_JOB_ID | Node: $SLURM_NODELIST"
echo "Start: $(date)"
echo "============================================================"
nvidia-smi --query-gpu=name,memory.total --format=csv,noheader
echo "============================================================"

# Using CIFAR-10 (real data) instead of synthetic
# Reduced grid: 4 depths × 5 λ_reg × 4 λ_target = 80 configs
# With warmup to avoid killing learning early
python files/experiments/hyperparameter_grid_search.py \
    --depths 4 6 8 10 \
    --lambda_regs 0.01 0.05 0.1 0.2 0.3 \
    --lambda_targets 0.0 -0.05 -0.1 -0.2 \
    --hidden_dim 256 \
    --epochs 15 \
    --batch_size 128 \
    --T 8 \
    --lr 0.001 \
    --data_dir ./data \
    --out_dir runs/grid_search_cifar10 \
    --device cuda

echo "============================================================"
echo "Finished: $(date)"
echo "============================================================"