po03087 commited on
Commit
aca5cc9
·
verified ·
1 Parent(s): 4f3fc40

Add SETUP.md — end-to-end setup instructions

Browse files
Files changed (2) hide show
  1. README.md +2 -1
  2. SETUP.md +153 -0
README.md CHANGED
@@ -12,7 +12,7 @@ Code for running **SRA**, a modular future-interaction graph that plugs into thr
12
  trajectory predictors — **MID** (DDPM), **LED** (leapfrog-DDPM) and **MoFlow** (flow matching) —
13
  on **NBA**, **Soccer** and **Football**.
14
 
15
- ## 👉 Start here: [`RUNNING.md`](RUNNING.md)
16
 
17
  It covers the required directory layout, environment setup, the exact training command for each
18
  host × dataset, the E2 ablation settings, environment-variable switches, the adapter contract,
@@ -20,6 +20,7 @@ and known gotchas.
20
 
21
  ## Documents
22
 
 
23
  - [`RUNNING.md`](RUNNING.md) — how to run every host × dataset
24
  - [`GAMEFORMER_SRA.md`](GAMEFORMER_SRA.md) — GameFormer+SRA negative result (does SRA generalize to feedforward models?)
25
  - [`sample_data/README.md`](sample_data/README.md) — bundled 100-scene NBA smoke-test subset
 
12
  trajectory predictors — **MID** (DDPM), **LED** (leapfrog-DDPM) and **MoFlow** (flow matching) —
13
  on **NBA**, **Soccer** and **Football**.
14
 
15
+ ## 👉 Start here: [`SETUP.md`](SETUP.md) — download, install, run
16
 
17
  It covers the required directory layout, environment setup, the exact training command for each
18
  host × dataset, the E2 ablation settings, environment-variable switches, the adapter contract,
 
20
 
21
  ## Documents
22
 
23
+ - [`SETUP.md`](SETUP.md) — end-to-end setup from scratch (env, data, paths, first run)
24
  - [`RUNNING.md`](RUNNING.md) — how to run every host × dataset
25
  - [`GAMEFORMER_SRA.md`](GAMEFORMER_SRA.md) — GameFormer+SRA negative result (does SRA generalize to feedforward models?)
26
  - [`sample_data/README.md`](sample_data/README.md) — bundled 100-scene NBA smoke-test subset
SETUP.md ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Setup — from nothing to a running experiment
2
+
3
+ Copy-paste block. Assumes conda + an NVIDIA GPU. `$SRA` is wherever you want everything to live.
4
+
5
+ ```bash
6
+ export SRA=$HOME/sra && mkdir -p $SRA && cd $SRA
7
+ ```
8
+
9
+ ## 1. Environment
10
+
11
+ ```bash
12
+ conda create -n sra python=3.11 -y
13
+ conda activate sra
14
+ pip install torch==2.4.0 --index-url https://download.pytorch.org/whl/cu121
15
+ pip install easydict pyyaml tensorboard tqdm scipy matplotlib gitpython huggingface_hub numpy
16
+
17
+ # cuDNN fix — REQUIRED for MID and LED (otherwise .backward() dies with
18
+ # "Could not load library libcudnn_cnn_train.so.8 ... undefined symbol")
19
+ export LD_LIBRARY_PATH="$(ls -d $CONDA_PREFIX/lib/python3.11/site-packages/nvidia/*/lib | tr '\n' ':')$LD_LIBRARY_PATH"
20
+ ```
21
+
22
+ ## 2. Code
23
+
24
+ ```bash
25
+ cd $SRA
26
+ git clone https://huggingface.co/po03087/sra-trajectory-code code
27
+ # MoFlow/, MID/ and LED/ MUST stay siblings — MID and LED import the SRA graph from ../MoFlow
28
+ ls code # -> LED MID MoFlow RUNNING.md SETUP.md GAMEFORMER_SRA.md sample_data standalone
29
+ ```
30
+
31
+ ## 3. Data (+ LED pretrained cores)
32
+
33
+ ```bash
34
+ cd $SRA
35
+ huggingface-cli download po03087/sra-trajectory-data sra_data_full.zip \
36
+ --repo-type dataset --local-dir .
37
+ # or: wget https://huggingface.co/datasets/po03087/sra-trajectory-data/resolve/main/sra_data_full.zip
38
+
39
+ unzip -q sra_data_full.zip -d data
40
+ ls data # -> nba sport LED_pretrained_core README.md
41
+ ```
42
+
43
+ ## 4. Put the files where each host expects them
44
+
45
+ The three hosts use **different path conventions** — this is the step that goes wrong most often.
46
+
47
+ ```bash
48
+ cd $SRA
49
+
50
+ # MoFlow — NBA lives inside the repo
51
+ mkdir -p code/MoFlow/data/nba/original
52
+ cp data/nba/original/nba_*.npy code/MoFlow/data/nba/original/
53
+
54
+ # LED — NBA path is HARDCODED to ./data/files/nba_{train,test}.npy
55
+ mkdir -p code/LED/data/files
56
+ cp data/nba/original/nba_*.npy code/LED/data/files/
57
+
58
+ # LED — pretrained core denoising models (REQUIRED; LED crashes without them)
59
+ mkdir -p code/LED/results/checkpoints
60
+ cp data/LED_pretrained_core/*.p code/LED/results/checkpoints/
61
+
62
+ # LED — sport data_dir is read from the YAML, not the CLI
63
+ sed -i "s|^data_dir .*|data_dir : '$SRA/data/sport/soccer'|" code/LED/cfg/sport/soccer.yml
64
+ sed -i "s|^data_dir .*|data_dir : '$SRA/data/sport/football'|" code/LED/cfg/sport/football.yml
65
+
66
+ # MID and MoFlow read sport data straight from $SRA/data/sport/... via --data_dir
67
+ ```
68
+
69
+ Sanity check:
70
+
71
+ ```bash
72
+ python - <<'PY'
73
+ import numpy as np, os, glob
74
+ SRA = os.environ['SRA']
75
+ for p, want in [(f"{SRA}/code/MoFlow/data/nba/original/nba_train.npy", (32500,30,11,2)),
76
+ (f"{SRA}/code/MoFlow/data/nba/original/nba_test.npy", (12500,30,11,2)),
77
+ (f"{SRA}/code/LED/data/files/nba_train.npy", (32500,30,11,2)),
78
+ (f"{SRA}/data/sport/soccer/train.npy", (7164,30,23,2)),
79
+ (f"{SRA}/data/sport/football/train.npy", (37859,30,23,2))]:
80
+ a = np.load(p, mmap_mode='r'); print(("ok " if a.shape==want else "BAD "), p, a.shape)
81
+ print("LED cores:", [os.path.basename(x) for x in glob.glob(f"{SRA}/code/LED/results/checkpoints/*.p")])
82
+ PY
83
+ ```
84
+
85
+ ## 5. Smoke test (2 minutes, no real training)
86
+
87
+ ```bash
88
+ cd $SRA/code/MoFlow
89
+ CUDA_VISIBLE_DEVICES=0 python fm_nba_graph_v6.py \
90
+ --cfg cfg/nba/cor_fm.yml --exp smoke --data_dir ../sample_data/nba \
91
+ --n_train 100 --n_test 100 --batch_size 8 --epochs 1 \
92
+ --fm_in_scaling --tied_noise --top_n_neighbors 5 --uncertainty_weight 0.01
93
+ ```
94
+
95
+ ## 6. Real training — SRA on each host × dataset
96
+
97
+ ```bash
98
+ cd $SRA/code
99
+ ```
100
+
101
+ **MoFlow**
102
+ ```bash
103
+ cd $SRA/code/MoFlow
104
+ # NBA
105
+ CUDA_VISIBLE_DEVICES=0 python fm_nba_graph_v6.py \
106
+ --cfg cfg/nba/cor_fm.yml --exp nba_sra --data_dir ./data/nba \
107
+ --batch_size 192 --epochs 150 --fm_in_scaling --tied_noise \
108
+ --top_n_neighbors 5 --uncertainty_weight 0.01
109
+ # soccer / football (swap soccer <-> football)
110
+ CUDA_VISIBLE_DEVICES=0 python fm_sport_graph_v6.py \
111
+ --cfg cfg/sport/football.yml --exp football_sra --data_dir $SRA/data/sport/football \
112
+ --batch_size 64 --epochs 100 --top_n_neighbors 5 --uncertainty_weight 0.01
113
+ ```
114
+
115
+ **MID** — note NBA takes the `original/` dir *directly* (unlike MoFlow)
116
+ ```bash
117
+ cd $SRA/code/MID
118
+ # NBA
119
+ CUDA_VISIBLE_DEVICES=0 python main_nba_mid_graphv6_v3.py \
120
+ --data_dir $SRA/data/nba/original --exp_name mid_nba_sra \
121
+ --epochs 100 --batch_size 32 --lr 1e-3 --eval_every 5 --sampling ddim --sampling_step 10
122
+ # football (soccer: main_soccer_mid_graphv5_sigma_output.py)
123
+ python main_football_mid_graphv5_sigma.py \
124
+ --data_dir $SRA/data/sport/football --exp_name mid_football_sra --gpu 0 \
125
+ --epochs 100 --batch_size 64 --lr 1e-3 --graph_lr_mult 1.0 --eval_every 1 \
126
+ --top_n_neighbors 5 --uncertainty_weight 0.01 \
127
+ --train_mode two_pass --sampling ddim --sampling_step 20
128
+ ```
129
+
130
+ **LED** — must be launched from the `LED/` directory (hardcoded relative paths)
131
+ ```bash
132
+ cd $SRA/code/LED
133
+ # NBA
134
+ python main_led_nba_graph.py --cfg led_augment --gpu 0 --train 1 \
135
+ --use_v6_graph --use_sigma --top_n 5 --uncertainty_weight 1.0 --residual_on eps
136
+ # soccer / football
137
+ python main_sport_led.py --cfg football --gpu 0 --train 1 --use_v6_graph --residual_on eps
138
+ ```
139
+
140
+ ## Gotchas that will bite
141
+
142
+ | Symptom | Fix |
143
+ |---|---|
144
+ | `undefined symbol ... libcudnn_cnn_train.so.8` | the `LD_LIBRARY_PATH` export in §1 |
145
+ | LED: `FileNotFoundError: ./data/files/nba_train.npy` | copy NBA files there **and** run from `LED/` |
146
+ | LED: crash loading `base_diffusion_model*.p` | copy the cores into `LED/results/checkpoints/` |
147
+ | LED sport reads the wrong data | edit `data_dir` in the YAML — LED sport ignores a CLI `--data_dir` |
148
+ | MoFlow: `FileNotFoundError .../original/original/...` | `--data_dir` must be the **parent** of `original/` |
149
+ | MID sport ADE stuck ≈0.46 | use `--graph_lr_mult 1.0`, not 3.0 |
150
+ | dense sport (`--top_n_neighbors 22`) OOM at BS64 | use `--batch_size 32` |
151
+ | `ImportError: tensorboardX` | use `torch.utils.tensorboard` |
152
+
153
+ See [`RUNNING.md`](RUNNING.md) for the E2 ablation settings and all environment-variable switches.