SpatialDiffuseSlot โ ์ ์๋ฒ์์ ๋๋ฆฌ๋ ๋ฒ (2026-07-15 ์์ฑ, GPU batch-1 ๊ฒ์ฆ๋จ)
๋ฌด์: Semanticist DiT-L/ViT (tok_L pretrained init) + ์ฐ๋ฆฌ 85 multi-res attn-pool ํ ํฐ + ์ฐ๋ฆฌ spatial-align attention mask. DiT trunk freeze๋ก warmup(Phase-1) ํ unfreeze(Phase-2).
์ค๊ณ ๋ฐฐ๊ฒฝ/๋น๊ต๋ถ์: new_eval_spatial_reasoning0430/_worklog/SEMANTICIST_DIT_SPATIAL_SETUP.md, OURS_VS_SEMANTICIST.md.
ํ์ผ (์ ๋ถ semanticist repo ์)
| ํ์ผ | ์ญํ |
|---|---|
semanticist/stage1/spatial_diffuse_slot.py |
๋ณธ์ฒด: SpatialAttnPool(85ํ ํฐ) + DiTSpatial(mask ํ๋ฌ๋ฐ+CFG) + SpatialDiffuseSlot(tok_L init/freeze) |
spatial_mask.py |
xa_maskโ(149ร149) self-attn mask (์ ๋ํ
์คํธ ๋ด์ฅ: python spatial_mask.py) |
configs/tokenizer_l_spatial.yaml |
launch config (Phase-1: freeze_dit, warmup 100ep, batch eff 256) |
train_spatial_l.sh |
launch: GPUS=0,1,2,3 bash train_spatial_l.sh |
smoke_full_spatial.py |
CPU ํตํฉ smoke (init/fwd/bwd/freeze) |
smoke_gpu_batch1.py |
GPU batch-1 pre-flight (3 optimizer steps) โ ์ ์๋ฒ์์ launch ์ ์ด๊ฒ๋ถํฐ |
viz_mask_compare.py / mask_compare.png |
mask ์๊ฐํ (level๋ณ ํ ํฐโ๋ด๋น๋ถ์ ๊ฒ์ฆ) |
test_net.py (์์ ) |
SEM_STEPS=50 env๋ก eval sampling step override |
fid_L85_50step.py |
tok_L@85@50step rFID ์ฌ๊ณ์ฐ (recon ์ฌํ์ฉ) |
์ ์๋ฒ ์ฌ์ ์ค๋น (์์๋๋ก)
- venv: torch/accelerate/omegaconf/timm/diffusers/torch_fidelity (๊ธฐ์กด MNIST_debug venv ์ฌ์).
- weights:
semanticist_tok_L.pkl(2.2GB) โ โ ๏ธ 7/13 ๋ฒ๋ค eval_assets.tar์ ์์(7/15 ๋ค์ด๋ก๋). delta rsync ๋๋ HF์ ์ฌ๋ค์ด:huggingface.co/tennant/semanticist/resolve/main/semanticist_tok_L.pklโ config์init_from:๊ฒฝ๋ก๋ฅผ ์ ์์น๋ก ์์ . - DINOv2 (REPA):
TORCH_HOME์ dinov2_vitb14 ์บ์ (์์ผ๋ฉด torch.hub๊ฐ ์๋ ๋ค์ด๋ก๋ โ ์คํ๋ผ์ธ์ด๋ฉด ๊ธฐ์กด torch_cache ๋ณต์ฌ). - dataset ์ฌ๋ณผ๋ฆญ (semanticist repo ๋ฃจํธ์์):
(val = ์ฐ๋ฆฌmkdir -p dataset/imagenet ln -sfn <ImageNet>/train dataset/imagenet/train # 1000-class ImageFolder ln -sfn <balanced val 50k centercrop dir> dataset/imagenet/val/all # flat pngs (val ์๋ 1ํด๋์ค) ln -sfn <๊ฐ์ dir> dataset/imagenet/val256 # trainer eval real_dir ํ๋์ฝ๋ฉ์ฉeval_assets/val_real50k_centercrop. adm_in256_stats.npz๋ repofid_stats/์ ์ด๋ฏธ ์์.)
์คํ
# 0) ๊ฒ์ฆ (ํ์, ์์๋๋ก โ ์ ๋ถ PASS ํ launch)
python spatial_mask.py # mask ์ ๋ํ
์คํธ
CUDA_VISIBLE_DEVICES="" python smoke_full_spatial.py # CPU ํตํฉ
CUDA_VISIBLE_DEVICES=0 python smoke_gpu_batch1.py # GPU batch-1 (mem ~5.5GiB)
# 1) Phase-1 launch (DiT trunk frozen, encoder/pool/cond ํ์ต)
GPUS=0,1,2,3 bash train_spatial_l.sh # detach๋ setsid nohup ... & disown
# 2) Phase-2 (Phase-1 ์๋ ด ํ): configs/tokenizer_l_spatial.yaml์์
# freeze_dit: false + dit_lr_scale: 0.1 + ckpt_path: output/tokenizer/models_l_spatial/models/step<N>
# (+ blr ๋ฎ์ถ๊ธฐ ๊ถ์ฅ) ํ ์ฌlaunch.
๊ฒ์ฆ๋ ์์น (์ด ์๋ฒ, 2026-07-15)
- tok_L init: encoder 151/151, DiT trunk ์ ๋ถ ๋ก๋, drop=[null_cond(256โ85 fresh)]
- trainable 134.8M / total 752.7M (frozen trunk)
- batch1 bf16: 5.5GiB, ~0.1s/step (1GPU) | mask routing ๊ตญ์ํ ํ์ธ(perturb ์คํ 37ร)
- ๋ฐ์ดํฐ: train 1,281,103 / test 50,000
์ก์๋ ๋ฒ๊ทธ (์ฌ๋ฐ ์ฃผ์)
load_state_dict(strict=False)๋ shape mismatch๋ ์๋ฌ โ init_from ๋ก๋๊ฐ mismatch ํค ์๋ drop (null_cond).- encoder๋ num_slots=256 ์ ์งํด์ผ tok_L 100% ๋ก๋ (slot์ ์ ์, patch๋ง ์ฌ์ฉ โ patch๋ slot์ ์ ๋ด์ ์ค์ผ ์์).
- Semanticist DiT.forward๋ mask๋ฅผ ๋ธ๋ก์ ์ ๋๊น โ DiTSpatial์ด ํ๋ฌ๋ฐ (forward/forward_with_cfg ๋ ๋ค).
- mask ๊ท์น: latentโlatent full / latentโcond xa / condโlatent ์ฐจ๋จ / condโcond identity (all-False row = SDPA NaN ๋ฐฉ์ง).
- DiT out์ learn_sigma๋ผ 2รin_channels (loss์์ ๋ถ๋ฆฌ, diffusion lib๊ฐ ์ฒ๋ฆฌ).
- trainer๊ฐ
model.params.ckpt_path๋ฅผ ๋ฌด์กฐ๊ฑด ์ฝ์ โ config์ckpt_path: nullํ์ (init์init_from). - eval ๊ฒฝ๋ก: trainer๊ฐ
model.num_slots๋ก test_num_slots/drop_mask๋ฅผ ์ฌ์ด์ง โ 256์ด๋ฉด 85 cond์ ์ถฉ๋(5000-iter eval crash). SpatialDiffuseSlot์ดself.num_slots=85์ฌ์ง์ + NestedSampler(85) ์ฌ์์ฑ์ผ๋ก ํด๊ฒฐ (encoder ๋ด๋ถ num_slots=256์ ์ ์ง๋์ด ckpt ๋ก๋ ๋ฌด๊ด).