|
Download docs/training-log.md from backseollgi/Cerberus: direct link, hf CLI and curl.
- Browser
- Download file 20.2 kB
-
https://huggingface.co/backseollgi/Cerberus/resolve/main/docs/training-log.md
- Command line
-
hf download hf://backseollgi/Cerberus/docs/training-log.md
-
curl -L -o training-log.md https://huggingface.co/backseollgi/Cerberus/resolve/main/docs/training-log.md
20.2 kB
| # CERBERUS Stage-1 โ Training Log & Decisions | |
| Chunk-by-chunk history of the Stage-1 core pretrain (`runs/core`), and **why** the schedule | |
| was changed on 2026-08-09. Companion to [`training_plan.md`](training_plan.md) (the plan) | |
| and [`MIGRATION.md`](MIGRATION.md) (how to move servers). | |
| > Every relaunch appends provenance to `runs/core/run_info.txt` (git commit, dirty count, | |
| > GPUs, resume source) and a `git_diff_<ts>.patch`. This file is the human-readable summary. | |
| --- | |
| ## Chunk history | |
| | # | Window | Server | GPUs | eff. batch | Epochs | Ended by | | |
| |---|---|---|---|---|---|---| | |
| | 1 | 2026-07-30 15:51 โ 07-31 08:33 | `/data/pia` (local disk) | 2 (`0,1`) | 8 | 0 โ 25 | host reboot | | |
| | 2 | 2026-08-03 12:02 โ 08-04 07:16 | `/data/pia` (local disk) | 2 (`0,1`) | 8 | 24 โ 54* | manual stop | | |
| | 3 | 2026-08-09 ~02:00 โ | Backend.AI container, `/home/work/seoik` (NFS) | **3** (`0,1,2`) | **12** | 53 โ 107 | (running) | | |
| \* epoch 54 reached iter 1264/1500 and was discarded โ resume granularity is per-epoch, so | |
| **`checkpoint_53` is the real continuation point**. | |
| ### State at the end of chunk 2 (the resume point) | |
| - Total loss: 8.0 at start โ **~2.9 plateau from ~epoch 10 onward** (ep30 2.94, ep50 2.92, ep54 2.90 smoothed) | |
| - Complementarity LOSS terms `middleloss` (= 1 โ cos(z_a,z_m)) and `middleloss_bg` (= (1 + cos(z_m,z_b))/2) | |
| โ **โ 0** (converged, as designed). NOTE: these are losses, not cosines โ inverting them gives | |
| **cos(z_a,z_m) โ +1** (alignment) and **cos(z_m,z_b) โ โ1** (anti-correlation). See `base_task.py:264-270`. | |
| - LR: 1e-5 โ **8.53e-6** โ i.e. only 15% decayed after 53 epochs | |
| - Checkpoints: local `0..53`; HF backup `backseollgi/Cerberus/stage1_core/` `0..45` (+50) | |
| - Samples consumed: 79,500 step ร 8 = **636,000** | |
| --- | |
| ## Decision (2026-08-09): `max_epoch` 200 โ **107**, GPUs 2 โ **3** | |
| ### Why the plateau was not a convergence problem | |
| `hawk/common/optims.py:99` anneals cosine over **`max_epoch ร iters_per_epoch` total steps**: | |
| ```python | |
| lr = (init_lr - min_lr) * 0.5 * (1 + cos(pi * total_step / (max_epoch * iters_per_epoch))) + min_lr | |
| ``` | |
| So `max_epoch` is the **schedule length**, not a harmless cap. It was set to 200 as a | |
| "generous cap โ stop anytime after ~3 days" (commits `e11860c`, `95eda28`), which stretched | |
| the cosine over 300,000 steps. After 53 epochs we were only **26.5% into the schedule**, LR | |
| was still 8.53e-6, and the late-cosine decay that actually drives convergence had not begun. | |
| Continuing under `max_epoch: 200` meant **95 more hours** at a near-constant high LR. | |
| ### Why 107 specifically โ match the sample budget, not the epoch count | |
| Epoch numbers are **not comparable** between HAWK and CERBERUS; the units differ: | |
| | | original HAWK stage-1 | CERBERUS (chunk 3) | | |
| |---|---|---| | |
| | `iters_per_epoch` | 2,500 | 1,500 | | |
| | batch (per GPU) | 1 | 4 | | |
| | GPUs | 4 | 3 | | |
| | **samples per "epoch"** | **10,000** | **18,000** | | |
| Copying `max_epoch: 160` from HAWK would therefore train 20% *longer*, not equally. | |
| Matching **samples** instead: | |
| ``` | |
| HAWK stage-1 plan : 160 ep ร 2500 it ร 4 = 1.60M samples (ran to checkpoint_127 = 1.27M) | |
| CERBERUS target : 107 ep ร 1500 it ร 12 = 1.60M samples โ equivalent budget | |
| ``` | |
| Consequences at resume: | |
| | | under `max_epoch: 200` | under `max_epoch: 107` | | |
| |---|---|---| | |
| | position of `checkpoint_53` | 26.5% of schedule | **49.5%** | | |
| | LR on resume | 8.53e-6 | **5.57e-6** | | |
| | remaining wall-clock | 95.5 h (2 GPU) | **34.6 h** (3 GPU) | | |
| | LR at finish | ~5e-6 (never annealed) | **1e-6 = `min_lr`** | | |
| ### Why 3 GPUs actually saves time here (and why it isn't automatic) | |
| `iters_per_epoch` is **fixed at 1500**, so an "epoch" is a 39-minute checkpoint interval, not | |
| a pass over the data (one real pass over 2.63M samples would be ~329k iters). Adding a GPU | |
| therefore does **not** shrink epoch wall-clock โ it raises samples/step from 8 to 12. | |
| The speedup only materialises because we lowered `max_epoch` to match: reaching the same | |
| 1.60M-sample budget needs 133,333 steps at 12/step instead of 200,000 at 8/step. | |
| | | 2 GPU | 3 GPU | | |
| |---|---|---| | |
| | steps to 1.60M samples | 200,000 | **133,333** | | |
| | required `max_epoch` | 133 | **107** | | |
| | remaining wall-clock | 52.2 h | **34.6 h** | | |
| ### Known discontinuities at epoch 54 (expected, recorded here on purpose) | |
| 1. **LR steps down** 8.53e-6 โ 5.57e-6. Downward, so it does not fight the restored Adam | |
| moments (raising LR mid-run is the dangerous direction) and it helps leave the plateau. | |
| 2. **Effective batch 8 โ 12.** Gradients get less noisy from epoch 54 on. Report Stage-1 as | |
| "epochs 0โ53 at effective batch 8, 54โ107 at 12" rather than a single number. | |
| 3. Both land at the same point on the curve, so a small step in the loss/TensorBoard trace at | |
| epoch 54 is expected and is **not** a bug. | |
| `init_lr`, `min_lr`, `warmup_steps`, `iters_per_epoch`, `batch_size_train` and `seed` were | |
| **left untouched**, so the only intended changes are the two above. | |
| --- | |
| ## Environment notes for chunk 3 (new server) | |
| Moved from `/data/pia` (local disk) to a Backend.AI container with `/home/work/seoik` on NFS. | |
| Nothing else about the run changed. Gotchas hit during setup, recorded so they are not | |
| re-discovered: | |
| - **`/home/work/seoik` is the only persistent volume.** `$HOME` (`/home/work`) is container | |
| scratch and disappears with the session. Conda, caches and data must live under `seoik/`. | |
| `train_run.sh` now pins `TORCH_HOME` / `HF_HOME` there. | |
| - **The container ships its own conda** at `/home/work/miniconda3`, active as `base`, and its | |
| `envs_dirs` does not include ours โ so `conda run -n cerberus` silently resolves to the | |
| wrong prefix and fails with `No module named 'torch'`. `train_run.sh` now addresses the env | |
| by **absolute prefix** (`conda run -p /home/work/seoik/miniconda3/envs/cerberus`). | |
| - **NFS is the throughput bottleneck**, not CPU/RAM (83 cores, 676 GB idle). Measured: 25.8 MB/s | |
| sequential, 35 ms per small-file write, and **saturated at ~50 files/s regardless of | |
| parallelism** (8 / 32 / 64 workers all measured the same). Extracting 2.66M mp4 files took | |
| ~3 h; raising worker count does not help. | |
| - `scripts/extract_all_webvid.py` (new) replaces `build_webvid_split.py` here: one 9.1T volume | |
| means no big/small split or union symlinks are needed. It is resumable per shard via | |
| `<out>/.done/<page_dir>` markers. | |
| - **TensorBoard is NOT a complete record of this run.** chunk 1-2's event files stayed on the | |
| old server, so `runs/core/main/tensorboard/` starts at step 81,005. `train.log` is the only | |
| source covering epoch 0 onward (it is appended across chunks and travelled via HF). Use | |
| `scripts/plot_training_curves.py` to rebuild the full curves + a CSV from the log; it handles | |
| the re-run epochs at the resume points (25, 54) by letting the later record win. | |
| - Model build verified before training with | |
| `python scripts/smoke_test.py --cfg configs/train_configs/stage1_main.yaml` โ all three | |
| streams (appearance / motion / background) forward OK on H100 (sm_90), torch 2.11+cu128, | |
| transformers 4.28. | |
| --- | |
| # Stage-2 finetune (anomaly instruction tuning) โ ์ด ์๋ฒ, 2026-08-10 ์ฐฉ์ | |
| ## ์ค์ ๊ณผ ๊ทธ ๊ทผ๊ฑฐ | |
| | ํญ๋ชฉ | ๊ฐ | ๊ทผ๊ฑฐ | | |
| |---|---|---| | |
| | `ckpt` | `runs/core/main/checkpoint_106.pth` | stage1 ์ต์ข (LR์ด `min_lr`๊น์ง annealing ์๋ฃ) | | |
| | `max_epoch` | **160** (์๋ณธ ๊ทธ๋๋ก) | ์๋ ์์ฐ ๊ณ์ฐ ์ฐธ์กฐ | | |
| | `batch_size_train` | **2** (์๋ณธ 1) | GPU๊ฐ 4์ฅโ2์ฅ์ด๋ผ effective batch๋ฅผ ๋ง์ถ๊ธฐ ์ํด | | |
| | `iters_per_epoch` | 2500 (์๋ณธ ๊ทธ๋๋ก) | | | |
| | `num_workers` | 8 (์๋ณธ 16) | ์ค์ธก `data:` ์ง์ฐ 0.0000 โ 8๋ก ์ถฉ๋ถ, NFS ๋ถํ ์ ๊ฐ | | |
| | GPU | H100 2์ฅ (stage1์ 3์ฅ) | ์ธ์ ์ฌํ ๋น์ผ๋ก ๋ณ๊ฒฝ๋จ | | |
| **์ํ ์์ฐ โ ์๋ณธ๊ณผ ๋์ผํ๊ฒ ํต์ :** | |
| ``` | |
| ์๋ณธ HAWK stage2 : 160 ep x 2500 it x batch 1 x 4 GPU = 1.60M ์ํ (effective batch 4) | |
| ์ด ์๋ฒ : 160 ep x 2500 it x batch 2 x 2 GPU = 1.60M ์ํ (effective batch 4) | |
| ``` | |
| GPU ์ฅ์๊ฐ ์ ๋ฐ์ด ๋ ๋งํผ batch๋ฅผ 2๋ฐฐ๋ก ์ฌ๋ ค, **์ํ ์์ฐ๊ณผ effective batch๋ฅผ ๋ ๋ค** ์๋ณธ๊ณผ | |
| ์ผ์น์์ผฐ๋ค. ๊ทธ ๊ฒฐ๊ณผ `max_epoch`์ ์๋ณธ ๊ฐ 160์ ๊ทธ๋๋ก ์ธ ์ ์๋ค (stage1์์ 107๋ก ์ฌ๊ณ์ฐํด์ผ | |
| ํ๋ ๊ฒ๊ณผ ๋ค๋ฅธ ์ โ stage1์ `iters_per_epoch`๋ 1500์ผ๋ก ๋ฐ๊ฟจ๊ธฐ ๋๋ฌธ). | |
| **batch๋ฅผ ๋ ํค์ฐ์ง ์์ ์ด์ (2026-08-10 ์ค์ธก, 150 iter ๊ณต์ ๋น๊ต, H100 2์ฅ):** | |
| | batch | ์ ์์ํ s/it | max mem | ์ฒ๋ฆฌ๋ | 1.6M ์ํ ์์ | | |
| |---|---|---|---|---| | |
| | 2 | 1.369 | 45.7 GB | **2.92 samples/s** | 6.3์ผ | | |
| | 4 | 2.773 | 56.6 GB | 2.89 samples/s | 6.4์ผ | | |
| | 6 | 4.31 | 69.0 GB | 2.78 samples/s | 6.7์ผ | | |
| | 8 | โ | OOM (75.9 GB ํ ๋น ํ ์คํจ) | โ | โ | | |
| batch์ ๋น๋กํด iter ์๊ฐ์ด ๊ฐ์ด ๋์ด **์ฒ๋ฆฌ๋์ด ํํํ๋ค** = 32ํ๋ ์ x 3์คํธ๋ฆผ ์กฐํฉ์ด ์ด๋ฏธ | |
| ์ํ๋น ์ฐ์ฐ ํฌํ. VRAM์ ๋ ์ฑ์๋ ์ด๋์ด ์๊ณ batch 6๋ถํฐ๋ ์คํ๋ ค ์ ํ๋๋ฏ๋ก, ์ฌ์ 34GB๋ฅผ | |
| ๋จ๊ฒจ ๋ค์ผ ํ์ต์ OOM ์ํ์ ์ค์ด๋ batch 2๋ฅผ ํํ๋ค. `data:` ์ง์ฐ์ ๋ชจ๋ ์ค์ ์์ 0.0000์ด๋ผ | |
| NFS๋ ๋ณ๋ชฉ์ด ์๋๋ค. `PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True`๋ batch 6์ ์ ํ๋ฅผ | |
| ํด์ํ์ง ๋ชปํ๋ค(4.72 s/it) โ ๋จํธํ๊ฐ ์๋๋ผ ์ฐ์ฐ ํ๊ณ๋ผ๋ ๊ทผ๊ฑฐ. | |
| ## ์ฐฉ์ ์ ์ฒ๋ฆฌํ ์ด๊ด ๋ฌธ์ (๋ค๋ฅธ ์๋ฒ์์ ์ฌํํ ๋๋ ํ์) | |
| 1. **annotation์ ๋น๋์ค ๊ฒฝ๋ก๊ฐ ์์ ์ ์๋ฒ ์ ๋๊ฒฝ๋ก์๋ค.** ๋ฐฐํฌ๋ณธ JSON์ `video` ํ๋๊ฐ | |
| `/remote-home/share/jiaqitang/Data/...`์ธ๋ฐ, ๋ก๋๋ `os.path.join(vis_root, sample['video'])` | |
| (`video_instruct_dataset.py:128`)๋ฅผ ์ด๋ค. **๋ ๋ฒ์งธ ์ธ์๊ฐ ์ ๋๊ฒฝ๋ก๋ฉด `vis_root`๊ฐ ํต์งธ๋ก | |
| ๋ฌด์๋๋ฏ๋ก** config์ `videos_dir`๋ฅผ ๊ณ ์ณ๋ ์์ฉ์ด ์๋ค. ๊ฒ๋ค๊ฐ ๋ฐ์ดํฐ์ ์ด๋ฆ์ด ์ค์ ๋ฐฐํฌ๋ณธ | |
| ๋๋ ํ ๋ฆฌ๋ช ๊ณผ ๋ค๋ฅด๋ค(`UCF-Crime`โ`UCF_Crime`, `avenue/avenue/`โ`CUHK_Avenue/`, | |
| `ped1/ped1/`โ`Ped1/`, `ShanghaiTechDataset`โ`ShanghaiTech`). | |
| โ `scripts/localize_anomaly_annotations.py`๊ฐ `videos_dir` ๊ธฐ์ค ์๋๊ฒฝ๋ก๋ก ๋ณํํด | |
| `*.local.json`์ ๋ง๋ ๋ค(์๋ณธ ๋ณด์กด). train 7066 / test 786 / all 7852 ์ ๋ถ ๋งค์นญ ํ์ธ. | |
| 2. **config์ ๋จ์ ์๋ ์ธ๋ถ ๊ฒฝ๋ก 6๊ณณ**(`llama_model`, `tokenizer_name`, `prompt_path`, `ckpt`, | |
| `anno_dir`, `videos_dir`)์ ์ด ์๋ฒ ๊ธฐ์ค์ผ๋ก ๊ต์ฒด. `output_dir`๋ ๋ ํฌ ์(`output/`)์ ๊ฐ๋ฆฌํค๋ | |
| ๊ฒ์ `runs/` ์ ๋๊ฒฝ๋ก๋ก ์ฎ๊ฒผ๋ค(`train_run.sh` ์ฌ์ฉ ์์๋ run๋ณ๋ก ๋ฎ์ด์จ์ง). | |
| ## stage2์ ์์ค ๊ตฌ์กฐ๋ stage1๊ณผ ๋ค๋ฅด๋ค (๋ ผ๋ฌธ ์์ ์ ์ฃผ์) | |
| instruct ๋ฐ์ดํฐ๋ `conv_type='multi'` ๊ฒฝ๋ก(`video_llama.py:738-806`)๋ฅผ ํ๋๋ฐ, ์ฌ๊ธฐ์๋ ์ธ ์คํธ๋ฆผ์ | |
| ์๋ฒ ๋ฉ์ **ํ ํฐ์ผ๋ก concatํด LLaMA๋ฅผ ํ ๋ฒ๋ง** ํต๊ณผ์ํค๊ณ `loss_motion`ยท`loss_background`์ | |
| ๊ฐ์ `loss` ๊ฐ์ ๋ณต์ฌํด ๋ฐํํ๋ค. ๋ฐ๋ผ์ stage2 ์ด์์ค์ ์ค์ง์ ์ผ๋ก | |
| ``` | |
| total = 1.2 x LM์์ค + 0.1 x middleloss + 0.1 x middleloss_bg | |
| ``` | |
| ์ด๋ฉฐ, stage1์ฒ๋ผ ์คํธ๋ฆผ๋ณ ๋ ๋ฆฝ LM ์์ค์ด ์กด์ฌํ์ง ์๋๋ค. ์ด๋ ์๋ณธ HAWK ์ค๊ณ ๊ทธ๋๋ก์ด๊ณ ๋ฒ๊ทธ๊ฐ | |
| ์๋๋ค. ๋ก๊ทธ์ `motionloss`/`backgroundloss`๊ฐ `oriloss`์ ๋์ผํ๊ฒ ์ฐํ๋ ๊ฒ์ ์ ์์ด๋ค. | |
| ## ๋ ผ๋ฌธ ์์ฑ์ ํ์ํ ์ฐ์ถ๋ฌผ โ ํ์ต ์๋ฃ ์ ์๋๊ฐ ์ ๋ถ ์์ง๋์ด์ผ ํ๋ค | |
| `train_run.sh`๊ฐ `runs/stage2/`์ ์๋์ผ๋ก ๋จ๊ธฐ๋ ๊ฒ: | |
| - `main/checkpoint_{0..159}.pth` โ epoch๋ณ ์ฒดํฌํฌ์ธํธ (์ฝ 2GB x 160 = 320GB) | |
| - `main/tensorboard/` โ ์ค์นผ๋ผ 7์ข : `Loss/total`, `Loss/ori`, `Loss/motion`, `Loss/background`, | |
| `Loss/middle`, `Loss/middle_bg`, `Learning Rate` (global step = epoch x 2500 + i) | |
| - `train.log` โ ์ ๊ตฌ๊ฐ append. **TB๋ณด๋ค ์ด์ชฝ์ด ๊ถ์ ์๋ ๊ธฐ๋ก**์ด๋ค(chunk ์ฌ๊ฐ ์ TB๋ ๋๊ธธ ์ ์์) | |
| - `run_info.txt` โ chunk๋ณ provenance: config ๊ฒฝ๋ก, GPU, git commit + dirty ์ฌ๋ถ, resume ์ง์ | |
| - `config.yaml` โ ์คํ ์์ config ์ฌ๋ณธ | |
| - `git_diff_<ts>.patch` โ ์คํ ์์ ์ํนํธ๋ฆฌ diff | |
| ํ์ต ์๋ฃ ํ ์ถ๊ฐ๋ก ๋ง๋ค์ด์ผ ํ๋ ๊ฒ: | |
| - `scripts/plot_training_curves.py`๋ก stage2 ๊ณก์ + CSV ์์ฑ โ `figs/stage2_curves.{png,pdf,csv}` | |
| - HF `backseollgi/Cerberus/stage2_finetune/`์ ์ฒดํฌํฌ์ธํธ(๋ง์ผ์คํค+์ต์ข )ยท`train.log`ยท`config.yaml`ยท | |
| ๊ณก์ ๋ฐฑ์ (stage1๊ณผ ๋์ผํ ๋ฐฉ์) | |
| - E1/E2 ์ค์ธก: `scripts/extract_representations.py` + `experiments/disentanglement.py`๋ก CDS ์ฐ์ถ. | |
| **stage1 ์ฒดํฌํฌ์ธํธ์ stage2 ์ฒดํฌํฌ์ธํธ ์์ชฝ์์ ๋ฝ์์ผ** ๋ถ๋ฆฌ๋๊ฐ finetune์ผ๋ก ์ด๋ป๊ฒ ๋ณํ๋์ง | |
| ๋น๊ตํ ์ ์๋ค. | |
| - Table-1์ฉ VAD ์ ๋ ์์น (`scripts/run_eval.sh`, test split์ `all_videos_test.local.json`) | |
| --- | |
| ## NaN epoch ํ๊ท ์ ์ ์ฒด (2026-08-12, ์ค์ธก) | |
| `abl_flow` arm์ ๋ก๊ทธ์์ `Averaged stats`์ `totalloss`๊ฐ 28 epoch ์ค **9ํ `nan`** ์ผ๋ก | |
| ์ฐํ๊ณ , 26โ28์์ 3์ฐ์์ผ๋ก ๋ํ๋ฌ๋ค. ํ์ต ์คํจ๋ก ์ฝํ ์ ์๋ ํํ์ด๋ฏ๋ก ์์ธ์ ํ์ ํ๋ค. | |
| **์ค์ธก.** ์ถ๋ ฅ๋ iteration 7,032๊ฐ ์ค NaN์ **1๊ฐ**(0.014%)๋ค. epoch ํ๊ท ์ 2,500 iteration์ | |
| ํ๊ท ์ด๋ฏ๋ก **NaN ํ๋๊ฐ ์์ด๋ฉด ํ๊ท ์ ์ฒด๊ฐ NaN**์ด ๋๋ค. ์ฆ ๋ก๊ทธ์ `nan`์ "์ด epoch์ด | |
| ์คํจํ๋ค"๊ฐ ์๋๋ผ "์ด epoch์ NaN iteration์ด **์ ์ด๋ ํ๋** ์์๋ค"๋ ๋ป์ด๋ค. | |
| ์ค์ ๋ฐ์๋ฅ ์ epoch๋น ์ฝ 0.4ํ๋ค. ๊ทธ๋ฌ๋ฉด `P(epoch์ NaN โฅ 1) = 9/28 = 0.32`์ด๊ณ , | |
| 3์ฐ์์ด ๋ํ๋ ํ๋ฅ ์ 28 epoch ๊ตฌ๊ฐ์์ ์ฝ 60%๋ค. **3์ฐ์์ ์ ํ์ ์ฆ๊ฑฐ๊ฐ ์๋๋ผ ์ด | |
| ๋ฐ์๋ฅ ์์ ์์๋๋ ์ฌ๊ฑด์ด๋ค.** | |
| **๊ฐ์ค์น ํ์ธ.** `checkpoint_27.pth`์ ํ์ต ํ๋ผ๋ฏธํฐ 231๊ฐ ์ ๋ถ NaN/Inf ์์. AMP GradScaler๊ฐ | |
| NaN ์์ค์์ ์ตํฐ๋ง์ด์ ์คํ ์ ๊ฑด๋๋ฐ๋ฏ๋ก ๊ฐ์ค์น๊ฐ ์ค์ผ๋์ง ์๋๋ค. ์ ์ epoch์ loss๋ | |
| ๋จ์กฐ ํ๊ฐํ๋ค(1.537 โ 0.983). | |
| **๊ฐ์ ๊ธฐ์ค ๊ต์ฒด.** "์ฐ์ 3 epoch NaN"์ ์ด ๋ฐ์๋ฅ ์์ ์ฐ์ฐ๊ณผ ์ ํ๋ฅผ ๊ตฌ๋ณํ์ง ๋ชปํ๋ฏ๋ก ํ๊ธฐํ๋ค. | |
| | ํ๊ธฐ | ๋์ฒด | | |
| |---|---| | |
| | ์ฐ์ 3 epoch NaN | **์ถ๋ ฅ iteration์ NaN ๋น์จ > 1%** (ํ์ฌ 0.014%) | | |
| | | **์ฒดํฌํฌ์ธํธ์ NaN/Inf ํ๋ผ๋ฏธํฐ** (ํ์ฌ ์์) | | |
| | | **์ ์ epoch loss๊ฐ 3ํ ์ฐ์ ์์น** (ํ์ฌ ๋จ์กฐ ํ๊ฐ) | | |
| **๋ ผ๋ฌธ ํ๊ธฐ.** arm๋ณ NaN epoch ์๋ฅผ ๋ณด๊ณ ํ ๋ ์ด ๊ฐ์ฃผ๊ฐ ํจ๊ป ๊ฐ์ผ ํ๋ค. ์์น๋ง ์ ์ํ๋ฉด | |
| ์ฌ์ฌ์๊ฐ 9/28์ ํ์ต ๋ถ์์ ์ผ๋ก ์ฝ๋๋ค. ๋ณด๊ณ ํ์์ "NaN epoch 9/28 (iteration ์์ค | |
| NaN ๋น์จ 0.014%; epoch ํ๊ท ์ ๋จ์ผ NaN์ ์ํด ์ค์ผ๋๋ค)"๋ก ํ๋ค. | |
| ์ฌํ: | |
| ```bash | |
| $CERBERUS_PY - <<'EOF' | |
| import re, collections | |
| tot = collections.Counter(); nan = collections.Counter() | |
| for l in open('/home/work/seoik/runs/abl_flow/train.log', errors='ignore'): | |
| m = re.search(r'Train: data epoch: \[(\d+)\].*?totalloss: (nan|[0-9.]+)', l) | |
| if m: | |
| e = int(m.group(1)); tot[e] += 1 | |
| if m.group(2) == 'nan': nan[e] += 1 | |
| print(f'์ถ๋ ฅ {sum(tot.values())}๊ฐ ์ค NaN {sum(nan.values())}๊ฐ') | |
| EOF | |
| ``` | |
| --- | |
| ## random_mask arm ์ค๋จ๊ณผ ๋ฌ๋์ ์คํจ ๋ฏธ๊ฐ์ง (2026-08-13) | |
| `abl_random_mask` ๊ฐ **epoch 5, iteration 320 ๋ถ๊ทผ**์์ ๋ค์๊ณผ ๊ฐ์ด ์ฃฝ์๋ค. | |
| ``` | |
| RuntimeError: DataLoader worker (pid 3751766) is killed by signal: Killed. | |
| [ablation] arm=random_mask ์ข ๋ฃ (exit 1) | |
| [ablation] arm=duplicate ์์ โ ๋ฌ๋๊ฐ ์คํจ๋ฅผ ๋ฌด์ํ๊ณ ์งํ | |
| ``` | |
| **์์ ๋ฌธ์ ๊ฐ ์๋๋ค.** ์ฌํ ํ์ธ: RAM 2,015GB ์ค 1,898GB ์ฌ์ , `/dev/shm` 64GB(์ฌ์ฉ | |
| 276KB), GPU 46.8/81.6GB. ๊ฐ์ ๋ฐ์ดํฐ๋ก `flow` ๋ 40 epoch ์์ฃผํ๊ณ `duplicate` ๋ ๋ฌธ์ ์์ด | |
| ์งํ ์ค์ด๋ค. ์ผ์์ ๋ฉ๋ชจ๋ฆฌ ์คํ์ดํฌ๋ก ๋ณด์ด๋ฉฐ ์ฌํ๋์ง ์์๋ค. | |
| **๋ณต๊ตฌ ๊ฐ๋ฅ.** `checkpoint_4.pth` ์ `model`ยท`optimizer`ยท`scaler`ยท`epoch` ์ด ๋ชจ๋ ์์ด | |
| epoch 5 ๋ถํฐ ์ด์ด๊ฐ ์ ์๋ค(`train_run.sh` ๊ฐ ์ต์ ์ฒดํฌํฌ์ธํธ๋ฅผ ์๋์ผ๋ก ์ฐพ์ | |
| `resume_ckpt_path` ๋ก ๋๊ธด๋ค). | |
| ### ๋ฌ๋์ ๊ฒฐํจ๊ณผ ๋์ | |
| `run_ablation_arms.sh` ๋ `train_run.sh` ์ ์ข ๋ฃ ์ฝ๋๋ฅผ ํ์ธํ์ง ์๋๋ค. arm ํ๋๊ฐ 5 epoch | |
| ์์ ์ฃฝ์ด๋ ๋ค์ arm ์ผ๋ก ๋์ด๊ฐ๋ฏ๋ก, **๋์ผ ์์ฐ ํต์ ๊ฐ ์กฐ์ฉํ ๊นจ์ง๋ค.** | |
| ์คํ ์ค์ธ ์คํฌ๋ฆฝํธ๋ ํธ์งํ์ง ์์๋ค โ bash ๋ ์คํฌ๋ฆฝํธ๋ฅผ ๋ฐ์ดํธ ์คํ์ ์ผ๋ก ์ฝ์ผ๋ฏ๋ก | |
| ์งํ ์ค ํ์ผ์ ๊ณ ์น๋ฉด ๋จ์ ๋ถ๋ถ์ ์๋ชป ํด์ํ๋ค. ๋์ `run_ablation_followup.sh` ๋ฅผ ์๋ก | |
| ๋๊ณ , ์๋ฃ epoch ์๋ฅผ ํ์ธํด ๋ชฉํ์ ๋ชป ๋ฏธ์น๋ฉด ์ฌ์๋ํ๋๋ก ํ๋ค. | |
| ### ๊ฒ์ฆํ๋ ค๋ค ์ค์ ํ์ต์ ๋์ด ์ฌ๊ณ | |
| `ABL_ARMS="" bash scripts/run_ablation_followup.sh` ๋ก "arm ์์ด ์ํ๋ง ๋ณด์"๊ณ ์คํํ๋๋ฐ | |
| ํ์ต์ด ์์๋์ด `duplicate` ์ GPU ๋ฅผ ๋คํฌ์๋ค. ์์ธ์ `${ABL_ARMS:-๊ธฐ๋ณธ๊ฐ}` ์ `:-` ๊ฐ | |
| **๋น ๋ฌธ์์ด๋ ๊ธฐ๋ณธ๊ฐ์ผ๋ก ์นํ**ํ๋ค๋ ์ ์ด๋ค. ์ฆ์ ์ข ๋ฃํ์ฌ ํผํด๋ ์์๋ค(`duplicate` | |
| ์ ์ ์งํ, `random_mask` ์ฒดํฌํฌ์ธํธยท๋ก๊ทธ ๋ถ๋ณ). | |
| ์ธ ๊ฐ์ง ์์ ์ฅ์น๋ฅผ ๋ฃ์๋ค. | |
| | ์ฅ์น | ํจ๊ณผ | | |
| |---|---| | |
| | `--check` ํ๋๊ทธ | ์ํ๋ง ์ถ๋ ฅํ๊ณ ์ข ๋ฃ. ๊ฒ์ฆ ์ ํ์ต์ด ์์๋ ์ ์๋ค | | |
| | `${ABL_ARMS-...}` (`:` ์ ๊ฑฐ) | ๋น ๋ฌธ์์ด์ "arm ์์"์ผ๋ก ์กด์ค | | |
| | ์คํ ์ค ํ๋ก์ธ์ค ๊ฐ์ง | ๋ค๋ฅธ ์ ์ ํ์ต์ด ์์ผ๋ฉด ๊ฑฐ๋ถ(`ABL_FORCE=1` ๋ก๋ง ๋ฌด์) | | |
| ### ๋จ์ ์ผ์ | |
| ``` | |
| flow 40/40 ์์ฃผ | |
| random_mask 5/40 ์ฌ๊ฐ ํ์ | |
| duplicate 12/40 ์งํ ์ค | |
| zero 0/40 ๋๊ธฐ | |
| flow_reinit 0/40 ๋๊ธฐ | |
| ``` | |
| `zero` ์ข ๋ฃ ํ `bash scripts/run_ablation_followup.sh` ๋ก `random_mask` ์ฌ๊ฐ + | |
| `flow_reinit` ์คํ. ์ฝ 144 epoch ร 75๋ถ โ 7.5์ผ. | |
| --- | |
| ## duplicate arm ๋ฐ์ฐ (2026-08-13) | |
| `abl_duplicate` ๊ฐ **epoch 16, iteration 1430 ๋ถ๊ทผ์์ ๋ฐ์ฐ**ํ๋ค. ์ด์ ์ ์ฐ๋ฐ์ NaN ๊ณผ ์ฑ๊ฒฉ์ด | |
| ์ ํ ๋ค๋ฅด๋ค. | |
| ``` | |
| epoch 15 ๊น์ง : middleloss 0.0001, ์ ์ | |
| epoch 16 : iteration ~1430 ์ดํ totallossยทorilossยทmiddleloss ์ ๋ถ nan (์ถ๋ ฅ 250 ์ค 116) | |
| epoch 17 : ์์๋ถํฐ ์ ๋ถ nan | |
| ``` | |
| **๋ชจ๋ธ์ด ์ฃฝ์๋ค.** `checkpoint_16.pth` ์ ํ์ต ํ๋ผ๋ฏธํฐ **231๊ฐ ์ค 193๊ฐ๊ฐ ๋น์ ํ**์ด๋ค | |
| (`llama_proj_0.weight`, `video_query_tokens_*` ๋ฑ). ์ ์ ์ค์บ ๊ฒฐ๊ณผ **epoch 15 ๊ฐ ๋ง์ง๋ง ์ ์ | |
| ์ฒดํฌํฌ์ธํธ**๋ค(13ยท14ยท15 ์ ๋ถ 0/231). | |
| **ํ๋ณต ๋ถ๊ฐ.** AMP GradScaler ๋ NaN ์์ค์์ ์ตํฐ๋ง์ด์ ์คํ ์ ๊ฑด๋๋ฐ๋๋ฐ, ๊ฐ์ค์น๊ฐ ์ด๋ฏธ | |
| NaN ์ด๋ฉด ๋ชจ๋ forward ๊ฐ NaN ์ด๊ณ ๋ชจ๋ ์คํ ์ด ๊ฑด๋๋ฐ์ด์ง๋ค. ์ค์ค๋ก ๋น ์ ธ๋์ฌ ๊ฒฝ๋ก๊ฐ ์๋ค. | |
| ๋ฐ๋ผ์ ๊ณ์ ๋๋ ๊ฒ์ ์์ํ ๋ญ๋น์ด๋ฉฐ(arm ๋น ์ฝ 2์ผ), ์ค๋จํ๋ค. ๋ฌ๋๋ ๋ค์ arm(`zero`)์ผ๋ก | |
| ์งํํ๋ค. | |
| ### ์ด์ NaN ๊ณผ์ ๊ตฌ๋ณ | |
| | | ์ฐ๋ฐ์ NaN (flow arm) | ๋ฐ์ฐ (duplicate arm) | | |
| |---|---|---| | |
| | iteration NaN ๋น์จ | 0.014% (7,032 ์ค 1) | **46%** (250 ์ค 116), ์ดํ 100% | | |
| | ์ง์์ฑ | ๋จ๋ฐ, ๋ค์ iteration ์ ์ | ์์ ํ ๋๋์์ค์ง ์์ | | |
| | ๊ฐ์ค์น | ์ ๋ถ ์ ํ | **193/231 ๋น์ ํ** | | |
| | epoch ํ๊ท ์ด NaN ์ธ ์ด์ | ๋จ์ผ NaN ์ด ํ๊ท ์ ์ค์ผ | ์ค์ ๋ก ์ ๋ถ NaN | | |
| **์ ๊ฐ์ ๊ธฐ์ค์ด ์ด๊ฒ์ ์ก์๋ค.** "์ฐ์ 3 epoch NaN" ๊ธฐ์ค์ ๋ ๊ฒฝ์ฐ๋ฅผ ๊ตฌ๋ณํ์ง ๋ชปํ์ผ๋, | |
| ๊ต์ฒดํ ๊ธฐ์ค(iteration NaN ๋น์จ > 1% ยท ์ฒดํฌํฌ์ธํธ ๋น์ ํ ํ๋ผ๋ฏธํฐ)์ ๋ฐ์ฐ๋ง ๋ฐ๋ํ๋ค. | |
| ### ์์ธ ๋ฏธํ์ | |
| epoch 16 ์ ๊น์ง `middleloss` ๊ฐ 0.0001 โ 0.0003 ์ผ๋ก ์์ง์ด๊ธฐ ์์ํ๊ณ (์ ๋ฅ์ ์ดํ์ ์ด๊ธฐ | |
| ์ ํธ), ๊ทธ ์งํ ๋ฐ์ฐํ๋ค. `flow` arm ์์๋ epoch 28 ์ ์ดํ์ด ์์์ผ๋ ๋ฐ์ฐํ์ง ์๊ณ | |
| ํ๋ณตํ๋ค. ๋ ์ฌ๊ฑด์ด ๊ฐ์ ๊ธฐ์ ์ธ์ง, `duplicate` ์ ์ ์ ์ ๋ ฅ(์๋ณธ ํ๋ ์ ๋ณต์ )์ด ์ดํ์ ๋ | |
| ๋ถ์์ ํ๊ฒ ๋ง๋๋์ง๋ ํ์ ํ์ง ๋ชปํ๋ค. | |
| **ํํ ์์ค์ ๋๋ฉด ์ด ์คํจ ์์์ด ์ฌ๋ผ์ง ๊ฐ๋ฅ์ฑ์ด ๋๋ค.** ๋ ผ๋ฌธ์ `L_sim`ยท`L_dis` ๋ฅผ ๊ธฐ์ฌ๋ก | |
| ์ฃผ์ฅํ์ง ์์ผ๋ฏ๋ก `t_1 = t_4 = 0` ์ผ๋ก ๋๋ ๋ฐ ์์ค์ด ์๊ณ , ํต์ ์คํ์์ ์ผ ๋ ์ด์ ๋ ์๋ค. | |
| ์ฌ์คํ ์ ์ด ์ค์ ์ ๊ฒํ ํ ๊ฒ. | |
| ### ๋จ์ ์ํ | |
| ``` | |
| flow 40/40 ์์ฃผ | |
| random_mask 5/40 OOM kill (checkpoint_4 ์์ ์ฌ๊ฐ ๊ฐ๋ฅ) | |
| duplicate 17/40 ๋ฐ์ฐ (checkpoint_15 ์์ ์ฌ๊ฐ ๊ฐ๋ฅ) | |
| zero 0/40 ์งํ ์์ 2026-08-13 22:23 | |
| flow_reinit 0/40 ๋๊ธฐ | |
| ``` | |